各位大侠 :
        我正在学习存储过程,有几个简单的问题请大家帮忙:    1.我想根据表单中的一text中的内容,查询所要的资料,如果成功则返回资料在datagrid中,如果没有符合的资料,则返回一FALSE。
    2.如何保存表单中的text内容
    以上二个问题请各位给出如何写存储过程及如何调用,谢谢,在线等待。

解决方案 »

  1.   

    'VB中的一个按钮里面调用存储过程
    Private Sub Command1_Click()
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim sql As String
    Dim comm As New ADODB.Command
    Set cn = New ADODB.Connection
    cn.Open "Driver={SQL Server};Server=LPY;Uid=sa;Pwd=;database=CY"
    comm.ActiveConnection = cn
    comm.CommandType = adCmdStoredProc
    comm.CommandText = "lpy"
    Set rs = comm.Execute(1, Text1.Text)
    Set MSHFlexGrid1.DataSource = rs
    End Sub********被调用的存储过程 ****************************
    use CY
    go 
    if exists(select name from sysobjects where name= 'lpy' and type='p')
       drop procedure lpy
    go
    create procedure lpy 
    @money int
    as 
      select * from Cgongzi where 底薪>=@money
    order by 底薪 desc
    go 以上紧供参考