VB中使用存储过程(SQL数据库)
SQL存储过程CREATE PROCEDURE author
@lname varchar
as
select * from authors
where city=@lname ' city 字段类型是 varchar
GO
-------------------------------------------------------------
VB程序
Set lname = New ADODB.Parameter
Set mycommand = New
mycommand.ActiveConnection = cnn1
= "author"
= adCmdStoredProc
Set lname = mycommand.CreateParameter("city", adChar, adParamInput, 20, lname)
lname=Oakland
Set rstByQuery = New ADODB.Recordset
Set rstByQuery = mycommand.Execute()
Set MSFlexGrid1.DataSource = rstByQue
----------------------------------------------------
运行结果,无记录集.
但在运行SQL语句,则有记录集.
select * from authors where city='Oakland'
请在程序那里出了问题???