想鸟一样飞翔

专注于php开发。对c++也很有兴趣!!!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

存储过程如下
create  proc sp_recordset
  @bbb int
  as
  select * from aaa where bbb = @bbb
vb代码如下:

  Dim cmd As ADODB.Command
  Dim conn As ADODB.Connection
  Dim rs As ADODB.Recordset
  Dim ADOPrm
  Set ADOPrm = New ADODB.Parameter
 
 
  Set rs = New ADODB.Recordset
  Set conn = New ADODB.Connection
  conn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=DB_PurchaseOrder;Data Source=."
  conn.Open
 
  Set cmd = New ADODB.Command
  cmd.CommandType = adCmdStoredProc
  cmd.ActiveConnection = conn
  cmd.CommandText = "sp_recordset"
  Set ADOPrm = cmd.CreateParameter("@bbb", adInteger, adParamInput)
  cmd.Parameters.Append ADOPrm
  cmd.Parameters("@bbb").Value = "123"

   Set rs = cmd.Execute()
 
  MsgBox rs(0) & rs(1)

posted on 2007-08-09 21:50  redfox  阅读(512)  评论(0编辑  收藏  举报