Sign-up....

关于数据库查询语句的

我程序中从前面一个页面传递过来一个值,后面的页面接收此值,并进行相应处理

部分代码段:

dim carid

carid = Request.QueryString("car_id")

delcar = "delete * from VehicleInfo Where carid ="&carid

set deltemp = Server.CreateObject("ADODB.RecordSet")

deltemp.open delcar,conn,1,3

提示错误:

Microsoft OLE DB Provider for SQL Server (0x80040E14)

第 1 行: '*' 附近有语法错误

其中数据库表中的carid为numeric型,我用Response.Write("carid")检查前面页面传来的值,值是正确的.

[407 byte] By [msdn] at [2007-8-15 10:03:39]
# 1 Re: 关于数据库查询语句的

delete语句的*号已去掉,但报下面的错

第 1 行: '=' 附近有语法错误。

longyii at 2006-2-28 14:25:19 >
# 2 Re: 关于数据库查询语句的

dim carid

carid = Request.QueryString("car_id")

delcar = "delete * from VehicleInfo Where carid ="&carid

conn.execute(delcar)

batistuta97 at 2006-2-28 14:27:43 >
# 3 Re: 关于数据库查询语句的

写错了。。。

batistuta97 at 2006-2-28 14:28:03 >
# 4 Re: 关于数据库查询语句的

dim carid

carid = Request.QueryString("car_id")

delcar = "delete from VehicleInfo Where carid ='"&carid&"'"

conn.execute(delcar)

batistuta97 at 2006-2-28 14:29:16 >
# 5 Re: 关于数据库查询语句的

作为字符串处理会报下面的错

Microsoft OLE DB Provider for SQL Server (0x80040E07)

将数据类型 varchar 转换为 numeric 时出错。

longyii at 2006-2-28 14:31:45 >
# 6 Re: 关于数据库查询语句的

dim carid

carid = clng(Request.QueryString("car_id"))

delcar = "delete from VehicleInfo Where carid ="&carid

conn.execute(delcar)

batistuta97 at 2006-2-28 14:32:48 >
# 7 Re: 关于数据库查询语句的

还是不行,做了clng转换,没有符合条件的数据集了,但实际上是存在的..

longyii at 2006-2-28 14:51:28 >
# 8 Re: 关于数据库查询语句的

dim carid

carid = Request.QueryString("car_id")

delcar = "delete * from VehicleInfo Where carid ='"&carid & "'"

conn.execute(delcar)

DaGangBen at 2006-2-28 15:24:55 >
# 9 Re: 关于数据库查询语句的

你可以把delcar 变量response.wirte出来,再复制到查询分析器中执行。我觉得错误大概处在where语句那里

DaGangBen at 2006-2-28 15:29:04 >
# 10 Re: 关于数据库查询语句的

response.write delcar

把delcar输出来看看,再把语句放到SQL里面看看查询结果,分析原因

batistuta97 at 2006-2-28 15:36:26 >
# 11 Re: 关于数据库查询语句的

sql="delete * from VehicleInfo where carid='"&carid&"'"

这样改就行了

rimguncheng at 2006-2-28 16:33:56 >

Web

All Classified