This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / web page 高手帮我看看,我的code 有什么问题,多多谢了。
-waokool(waokool);
2002-6-12
{904}
(#571981@0)
-
I don't think you can use connection to execute statement, can you?
-jeffrey815(Smartiecat);
2002-6-12
(#571986@0)
-
Exactly, So what;s the problem? Thanks a lot.
-waokool(waokool);
2002-6-12
(#571997@0)
-
An error:sqlString=" INSERT INTO module1 (product_id,product_name, product_number)" &_
" VALUES( productid,productname,prouctnumber) "
This sentense is definately wrong. You put productid, productname, productnumber inside the quot....
-jeffrey815(Smartiecat);
2002-6-12
{238}
(#571996@0)
-
Thanks, So how to change it. As i said, I am not familiar with this Command, and especially about the useage of quotation marks.Could you please show me how to correct it ?Thanks a lot.
-waokool(waokool);
2002-6-12
(#572004@0)
-
好象是字符型的VALUE要用单引号,另外如果其中一个值没有PASS过来也会出错,最简单的办法show一下你的sql,马上可以发现错误
-rootbear(啤酒);
2002-6-12
{110}
(#572072@0)
-
Thanks. But what you mean showing my SQL? I use ACCESSI use ACCESS to bulid a database table.I don't know how to show it. I am sure the problem occurs in INSERT INTO syntax, but I can't figure out what error occurs. Maybe that 's what we called " blind point". tHANK YOU AGIAN.
-waokool(waokool);
2002-6-12
{228}
(#572090@0)
-
trysqlString=" INSERT INTO module1 (product_id,product_name, product_number)" &_
" VALUES( productid,productname,prouctnumber) "
'---------------------------------------------------------------------
respose.write sqlString '<------------here
'---------------------------------------------------------------------
Con.Execute sqlString
-rootbear(啤酒);
2002-6-12
{346}
(#572313@0)
-
SQL statment error, the right should be : sqlString=" INSERT INTO module1 (product_id,product_name, product_number)" &_
" VALUES( ' "& productid &" ', ' " &productname &" ', ' " & prouctnumber & " ' ) "if your productid is number, you needn't ' for that one.
one suggestion:
you write: TRIM (Request ("product name"))
in Form, don't use space for the name of item, use _ is better
-xiaodongxi(xiaodongxi);
2002-6-12
{192}
(#572395@0)
-
my answer...
-gamma(gamma);
2002-6-12
{625}
(#572624@0)
-
waokool是在ODBC里设置了数据源. 我也喜欢用ODBC, 在CODE里不用写一大堆的东西. 从他的错误来看,数据库已经连上了,只是没有参数传上去. 但是waokool 你要注意, 用ACCESS数据库, 不要把MDB文件放在WEB FOLDER里面,不然会给人DOWNLOAD下来的. 你用ODBC, 你想放哪里都可以.
-xiaodongxi(xiaodongxi);
2002-6-12
{53}
(#572791@0)
-
Thank you all.Reply for all friends. the code still doesn't work.IE show some information.Hi, my friends. I agree with the INSERT INTO syntax suggested by xiaodongxi and Gamma, I can find a similar example on book, But it looks sth. wrong wrong with "Con.Execute sqlString". After I modified the INSERT INTO , the IE show "
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access 驱动程序] 标准表达式中数据类型不匹配。
/myweb/mgpr.asp, line 20 "
The line 20 is "Con.Execute sqlString"
So what's the problem. Give me a hand. Thank you all.
-waokool(waokool);
2002-6-12
{502}
(#573892@0)
-
For example, if you are passing string into a field that's defined as type "number". Then you will get that error.
-jeffrey815(Smartiecat);
2002-6-12
(#573928@0)
-
Nice to see you again. I've checked the database table. Nothing wrong with data type.As for your second suggestion, to be honest, I am not clear. I am just beginner.
-waokool(waokool);
2002-6-12
(#573963@0)
-
If you don't use ODBC, you can put it anywhere as well... Use ODBC is slower, by the way. OLEDB connection is the fastest.
-jeffrey815(Smartiecat);
2002-6-12
(#573922@0)