Hello everyone, having experience in VB & ADO but not a minute with SQL 2000 Stored Procedures, I hope someone can straighten me out with this stuff. I am using ADO to run a stored procedure which simply gets the sum of a field. Below is the code for VB & the stored procedure - @SumTime parameter always returns NULL.
//yada yada - cmd is ado.command object
With cmd
.CommandType = adCmdStoredProc
.CommandText = "GetTechData" 'stored procedure
.Parameters.Append cmd.CreateParameter("@Tech", adVarChar, adParamInput, 25) 'input param
.Parameters("@Tech"
.Value = "Moore"
.Parameters.Append cmd.CreateParameter("@SumTime", adDouble, adParamOutput, 5) 'output param
.ActiveConnection = cn
End With
cmd.Execute
msgbox cmd.Parameters("@SumTime"
.Value 'always = NULL!
Stored procedure:
CREATE PROCEDURE GetTechData (
@Tech varchar(25),
@SumTime real OUTPUT)
AS
SELECT @SumTime = SUM(SERVICETIME) FROM TIMECARDENTRIES
WHERE (EMPLOYEEUSERNAME = @Tech)
Notes:
No NULL values in TimeCardEntries table.
SQL Field for ServiceTime is REAL, I had to use adDouble with ADO - I don't think that's the problem.
Any comments surely appreciated.
//yada yada - cmd is ado.command object
With cmd
.CommandType = adCmdStoredProc
.CommandText = "GetTechData" 'stored procedure
.Parameters.Append cmd.CreateParameter("@Tech", adVarChar, adParamInput, 25) 'input param
.Parameters("@Tech"

.Parameters.Append cmd.CreateParameter("@SumTime", adDouble, adParamOutput, 5) 'output param
.ActiveConnection = cn
End With
cmd.Execute
msgbox cmd.Parameters("@SumTime"

Stored procedure:
CREATE PROCEDURE GetTechData (
@Tech varchar(25),
@SumTime real OUTPUT)
AS
SELECT @SumTime = SUM(SERVICETIME) FROM TIMECARDENTRIES
WHERE (EMPLOYEEUSERNAME = @Tech)
Notes:
No NULL values in TimeCardEntries table.
SQL Field for ServiceTime is REAL, I had to use adDouble with ADO - I don't think that's the problem.
Any comments surely appreciated.