Create PROCEDURE GetSumValue
(@学号 int, @学期 char(8),@SumValue int output)
AS
Select @SumValue=课程1+课程2+课程3+课程4+课程5+课程6+课程7+课程8+课程9+课程10+课程11+课程12+课程13+课程14 From 成绩 where 学号=@学号 and 学期=@学期 
go用VB如何取得该存储过程中@SumValue的值?请给出代码。
谢谢

解决方案 »

  1.   

    Dim cmdSum As New ADODB.Command
    Dim sngSum As single
    sngSum = 0
    With cmdSum
         .ActiveConnection = coNN
         .CommandText = "GetSumValue"
         .CommandType = adCmdStoredProc
         .Parameters.Refresh
         .Parameters("@学号").Value = "学号"
         .Parameters("@学期").Value = "学期"
         .Execute
         If Not IsNull(.Parameters("@SumValue")) Then
                sngsum = .Parameters("@SumValue")
         End If
    End With Set cmdSum = Nothing