Still Having SQL Stored Proc probs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Newman

    #1

    Still Having SQL Stored Proc probs

    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.O peratorLogon"
    STR_SQLCOMMAND. CommandType = CommandType.Sto redProcedure
    STR_SQLCOMMAND. CommandTimeout = 30


    With STR_SQLCOMMAND
    ' set the query commands
    .CommandText = "BossData.dbo.O peratorLogon"
    .CommandType = CommandType.Sto redProcedure
    .CommandTimeout = 30

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

    For Counter = 0 To Err.Errors.Coun t - 1
    errorMessages += "Message " &
    Err.Errors(Coun ter).Message & ControlChars.Ne wLine
    Next
    Console.WriteLi ne(errorMessage s)
    End Try
    End With
    'read the results
    While STR_SQLREADER.R ead()
    'Obtain values from each row here...
    Console.WriteLi ne(CStr(STR_SQL READER(0)))
    ' set the function return
    LogonUsers = CInt(STR_SQLREA DER(0))
    End While
    ' clearup
    STR_SQLREADER.C lose()


    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

  • Cor Ligthert [MVP]

    #2
    Re: Still Having SQL Stored Proc probs

    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

    "Peter Newman" <PeterNewman@di scussions.micro soft.com> schreef in bericht
    news:1B7AA267-3D07-4FD2-89DE-572942E65869@mi crosoft.com...[color=blue]
    > 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.O peratorLogon"
    > STR_SQLCOMMAND. CommandType = CommandType.Sto redProcedure
    > STR_SQLCOMMAND. CommandTimeout = 30
    >
    >
    > With STR_SQLCOMMAND
    > ' set the query commands
    > .CommandText = "BossData.dbo.O peratorLogon"
    > .CommandType = CommandType.Sto redProcedure
    > .CommandTimeout = 30
    >
    > ' set the connection
    > .Connection = CON_BOSSCONNECT ION
    > ' Set the 1st Parameter
    > .Parameters.Add ("@OperatorName ", SqlDbType.VarCh ar, 20).Value =
    > InputString(0)
    > ' Set the 2nd Parameter
    > .Parameters.Add ("@OperatorPass word", SqlDbType.VarCh ar,
    > 20).Value = InputString(1)
    > ' Set the 3rd Parameter
    > .Parameters.Add ("@PasswordLife ", SqlDbType.VarCh ar, 3).Value =
    > InputString(2)
    > Try
    > ' execute the query Use ExecuteScalar as only returning a
    > single value
    > STR_SQLREADER = .ExecuteReader( )
    > Catch Err As SqlClient.SqlEx ception
    > Dim errorMessages As String
    > Dim Counter As Integer
    >
    > For Counter = 0 To Err.Errors.Coun t - 1
    > errorMessages += "Message " &
    > Err.Errors(Coun ter).Message & ControlChars.Ne wLine
    > Next
    > Console.WriteLi ne(errorMessage s)
    > End Try
    > End With
    > 'read the results
    > While STR_SQLREADER.R ead()
    > 'Obtain values from each row here...
    > Console.WriteLi ne(CStr(STR_SQL READER(0)))
    > ' set the function return
    > LogonUsers = CInt(STR_SQLREA DER(0))
    > End While
    > ' clearup
    > STR_SQLREADER.C lose()
    >
    >
    > 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
    >[/color]


    Comment

    Working...