To:1。如何在VB程序中创建和执行存储过程???给你贴一段代码看看就明白了:Dim ii          As Integer
Dim iID         As Integer
Dim strUnit     As String
Dim l_cmd       As ADODB.Command
    f_WriteData = True
    With msgGrid
    TBLwhName = .TextMatrix(.Row, 3)
    Set l_cmd = New ADODB.Command
    Screen.MousePointer = vbHourglass
    
    For ii = 1 To .Rows - 1
        l_cmd.CommandType = adCmdStoredProc
        l_cmd.CommandText = "pr_Adjust
        On Error GoTo err_DataBaseErr
        strUnit = f_Get_Unit(.TextMatrix(ii, 4))
        l_cmd.ActiveConnection = padoCnPrice"
        
        l_cmd.CreateParameter , adDate, adParamInput
        l_cmd.CreateParameter , adChar, adParamInput, 10
        l_cmd.CreateParameter , adChar, adParamInput, 8
        l_cmd.CreateParameter , adInteger, adParamInput
        l_cmd.CreateParameter , adCurrency, adParamInput
        l_cmd.CreateParameter , adCurrency, adParamInput
        l_cmd.CreateParameter , adCurrency, adParamInput
        l_cmd.CreateParameter , adChar, adParamInput, 50
        l_cmd.CreateParameter , adChar, adParamInput, 4
        l_cmd.CreateParameter , adChar, adParamInput, 10
        l_cmd.CreateParameter , adInteger, adParamOutput
        
        l_cmd.Parameters(1) = Format(Date, "yyyy-mm-dd")
        l_cmd.Parameters(2) = Trim(.TextMatrix(ii, 3))
        l_cmd.Parameters(3) = Trim(.TextMatrix(ii, 4))
        l_cmd.Parameters(4) = CInt(.TextMatrix(ii, 8))
        l_cmd.Parameters(5) = CCur(.TextMatrix(ii, 7))
        l_cmd.Parameters(6) = CCur(.TextMatrix(ii, 10))
        l_cmd.Parameters(7) = CCur(.TextMatrix(ii, 11))
        l_cmd.Parameters(8) = Trim(.TextMatrix(ii, 12))
        l_cmd.Parameters(9) = Operator.Code
        l_cmd.Parameters(10) = strUnit
        l_cmd.Parameters(11) = iID
        
        l_cmd.Execute
        .TextMatrix(ii, 0) = l_cmd.Parameters(11).Value
        
    Next ii
    Screen.MousePointer = vbDefault
    End With
    Set l_cmd = Nothing