Hi,
I have created an app where the user enters a project number, and a stored procedure on a sql server 2000 box is called, and results are returned. If I just run the stored procedure through Server explorer, and enter some parameters results are displayed in the output window. I cant figure out why the code I have created does not display any results. Below is the code:
dbCommand = New OdbcCommand
Dim prmSchoolName As OdbcParameter = New OdbcParameter("@sSchoolName", OdbcType.VarChar, 40, ParameterDirection.Output)
Dim prmReturnVal As OdbcParameter = New OdbcParameter("@RETURN_VALUE", OdbcType.Int, 4, ParameterDirection.ReturnValue)
With dbCommand
.Connection = dbConn
.CommandType = CommandType.StoredProcedure
.CommandText = "spSelectTeacher"
.Parameters.Add(prmReturnVal)
.Parameters.Add("@sRegion", OdbcType.Char).Value = "C"
.Parameters.Add("@iTeacherId", OdbcType.Int).Value = 950603
.Parameters.Add("@iFacultyId", OdbcType.Int, 4, ParameterDirection.Output)
.Parameters.Add(prmSchoolName)
End With
dbCommand.ExecuteReader()
Console.WriteLine(prmReturnVal.Value)
I am never getting a return value. I just need the results of the facultyid and school name. Please help
I have created an app where the user enters a project number, and a stored procedure on a sql server 2000 box is called, and results are returned. If I just run the stored procedure through Server explorer, and enter some parameters results are displayed in the output window. I cant figure out why the code I have created does not display any results. Below is the code:
dbCommand = New OdbcCommand
Dim prmSchoolName As OdbcParameter = New OdbcParameter("@sSchoolName", OdbcType.VarChar, 40, ParameterDirection.Output)
Dim prmReturnVal As OdbcParameter = New OdbcParameter("@RETURN_VALUE", OdbcType.Int, 4, ParameterDirection.ReturnValue)
With dbCommand
.Connection = dbConn
.CommandType = CommandType.StoredProcedure
.CommandText = "spSelectTeacher"
.Parameters.Add(prmReturnVal)
.Parameters.Add("@sRegion", OdbcType.Char).Value = "C"
.Parameters.Add("@iTeacherId", OdbcType.Int).Value = 950603
.Parameters.Add("@iFacultyId", OdbcType.Int, 4, ParameterDirection.Output)
.Parameters.Add(prmSchoolName)
End With
dbCommand.ExecuteReader()
Console.WriteLine(prmReturnVal.Value)
I am never getting a return value. I just need the results of the facultyid and school name. Please help