Still Having SQL Stored Proc probs

G

Guest

ok this is getting far to technical for me now .. lol

thank you all for the help yesterday, however im still stumbling on one bit
... heres my code so far

Dim InputString() As String
Dim ReturnValue As Integer

InputString = Split(InputParm, ";")
' set the query commands
STR_SQLCOMMAND.CommandText = "BossData.dbo.OperatorLogon"
STR_SQLCOMMAND.CommandType = CommandType.StoredProcedure
STR_SQLCOMMAND.CommandTimeout = 30


With STR_SQLCOMMAND
' set the query commands
.CommandText = "BossData.dbo.OperatorLogon"
.CommandType = CommandType.StoredProcedure
.CommandTimeout = 30

' set the connection
.Connection = CON_BOSSCONNECTION
' Set the 1st Parameter
.Parameters.Add("@OperatorName", SqlDbType.VarChar, 20).Value =
InputString(0)
' Set the 2nd Parameter
.Parameters.Add("@OperatorPassword", SqlDbType.VarChar,
20).Value = InputString(1)
' Set the 3rd Parameter
.Parameters.Add("@PasswordLife", SqlDbType.VarChar, 3).Value =
InputString(2)
Try
' execute the query Use ExecuteScalar as only returning a
single value
STR_SQLREADER = .ExecuteReader()
Catch Err As SqlClient.SqlException
Dim errorMessages As String
Dim Counter As Integer

For Counter = 0 To Err.Errors.Count - 1
errorMessages += "Message " &
Err.Errors(Counter).Message & ControlChars.NewLine
Next
Console.WriteLine(errorMessages)
End Try
End With
'read the results
While STR_SQLREADER.Read()
'Obtain values from each row here...
Console.WriteLine(CStr(STR_SQLREADER(0)))
' set the function return
LogonUsers = CInt(STR_SQLREADER(0))
End While
' clearup
STR_SQLREADER.Close()


Im getting this error message,

Message Procedure or Function 'OperatorLogon' expects parameter
'@ReturnValue', which was not supplied.

so my next question is in this case how do i
1. add the parameter @returnValue which is a type Integer and direction
Output from the stored proc
2. how do i read it ?

thanks again for your contuined help
 
C

Cor Ligthert [MVP]

Peter,

I don't see it in your code, therefore you have to look in your SP what for
'@ReturnValue' is expected.

I assume that the SP is just not right in this case.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top