调用存储过程出错,谁帮忙看看啊
存储过程如下:
Alter Procedure [dbo].Source_add
(
@cpname varchar(200),--产品名称
@guige varchar(200),--产品规格
@danwei char(30),--产品单位
@price float,--产品单价
@shuliang int,--产品数量
@owner varchar(200),--供货商
@jhdate datetime,--进货日期
@remark text --备注
)
As
SET NOCOUNT ON
Begin
Insert Into [dbo].Source
(cpname,guige,danwei,price,shuliang,owner,jhdate,remark)
Values
(@cpname,@guige,@danwei,@price,@shuliang,@owner,@jhdate,@remark)
End
SET NOCOUNT OFF
调用页面:
owner=Getvalue( "owner ",1)
cpname=Getvalue( "cpname ",1)
guige=Getvalue( "guige ",0)
danwei=Getvalue( "danwei ",1)
price=Getvalue( "price ",1)
shuliang=Getvalue( "shuliang ",1)
remark=Getvalue( "remark ",0)
jhdate=Getvalue( "jhdate ",1)
Set cmd=Server.CreateObject( "ADODB.Command ")
With cmd
.CommandType = adCmdStoredProc
.CommandText = "Source_add "
With .Parameters
.Append cmd.CreateParameter( "strcpname ",adVarChar,adParamInput,200,cpname)
.Append cmd.CreateParameter( "strguige ",adVarChar,adParamInput,200,guige)
.Append cmd.CreateParameter( "strdanwei ",adVarChar,adParamInput,30,danwei)
.Append cmd.CreateParameter( "strprice ",adInteger,adParamInput,,price)
.Append cmd.CreateParameter( "strshuliang ",adInteger,adParamInput,,shuliang)
.Append cmd.CreateParameter( "strowner ",adVarChar,adParamInput,200,owner)
.Append cmd.CreateParameter( "strjhdate ",adDate,adParamInput,,jhdate)
.Append cmd.CreateParameter( "strremark ",adLongVarChar,adParamInput,1024*300,remark)
End With
.ActiveConnection = conn
.Execute,,adExecuteNoRecords
End With
Response.Redirect "Source.asp "
Set cmd=Nothing
Closeconn
提示“.Execute,,adExecuteNoRecords”这行出错
出错提示“
Microsoft OLE DB Provider for ODBC Drivers错误 '80040e21 '
[Microsoft][ODBC SQL Server Driver]没有执行可选特性
/xyjd/www/Source_add_save.asp,行 29
”
[解决办法]
直接 .Execute 删除后面的试试.
[解决办法]
.Execute,,adExecuteNoRecords
修改成 .Execute看看
[解决办法]
Alter Procedure [dbo].Source_add
应该是Create Procedure [dbo].Source_add 吧
[解决办法]
呃...with块嵌套产生的问题?
[解决办法]
with 块我记得不能嵌套.
with Cmd
...
.Parameters.Append = .createparameter(.....
.....
.execute()
end with
再试.
[解决办法]
错误的原因是诸如adLongVarChar、adParamInput之类的变量,asp不认识,如果包含adovbs.inc文件就可以了,win2000 server的c:\interpub\wwwroot下面好像有这个文件