Ask a Question related to ASP.NET General, Design and Development.
-
ElmoWatson #1
Stored Procedure/Parameter problem
I'm getting an error I don't understand....
Here's my Code:
Dim dr As SqlDataReader
Dim retVal As Boolean = False
Dim MySQL as string = "spGetEmployee"
Dim Myconn as New
SQLConnection(ConfigurationSettings.AppSettings("E mpLogin"))
Dim Cmd as New SQLCommand(MySQL, MyConn)
cmd.CommandType=CommandType.StoredProcedure
cmd.parameters.add(New SQLParameter("@Login", txtUID.text))
cmd.parameters.add(New SQLParameter("@Password", txtPWD.text))
cmd = New SqlCommand(MySQL, MyConn)
MyConn.Open()
dr = cmd.ExecuteReader()
But on that last line (executeReader), I get this error:
Procedure 'spGetEmployee' expects parameter '@Login', which was not supplied
What am I doing wrong?
ElmoWatson Guest
-
#40143 [Opn->Bgs]: how to get parameter values of stored procedure.?
ID: 40143 Updated by: tony2001@php.net Reported By: hd4_all at yahoo dot co dot in -Status: Open +Status: ... -
#40143 [NEW]: how to get parameter values of stored procedure.?
From: hd4_all at yahoo dot co dot in Operating system: windows 2000 prof. PHP version: 5.2.0 PHP Bug Type: MySQLi related... -
populate datagrid with stored procedure w/parameter
All, I'm trying to populate a datagrid with a data adapter that uses a stored procedure with a parameter. I get the below error when I run my... -
Called a Stored Procedure , decimal parameter
I have a stored procedure with a decimal parameter . how can send the decimal value? I try this but it gives an error , invalid cast specified. ... -
Call a stored procedure with decimal parameter
I have a stored procedure with a decimal parameter . how can send the decimal value? I try this but it gives an error , invalid cast specified. ... -
Jerry #2
Re: Stored Procedure/Parameter problem
Marina is correct. You can also just comment out cmd = New SqlCommand(MySQL,
MyConn)
line of code.
"Marina" <zlatkinam@nospam.hotmail.com> wrote in message
news:u5FMYcqWDHA.1640@TK2MSFTNGP10.phx.gbl...> When you say: cmd = new SqlCommand(MySQL,MyConn), this creates a new
> SqlCommand object.
>
> All the parameters you set before, just got wiped out, because the object
> you set it on, no longer exists.
>
> Move the parameter statements to after this constructor call.
>
> "ElmoWatson" <sputnik75043@yahoo.com> wrote in message
> news:%23XPL9aqWDHA.2424@TK2MSFTNGP12.phx.gbl...> supplied> > I'm getting an error I don't understand....
> >
> > Here's my Code:
> >
> >
> > Dim dr As SqlDataReader
> > Dim retVal As Boolean = False
> > Dim MySQL as string = "spGetEmployee"
> > Dim Myconn as New
> > SQLConnection(ConfigurationSettings.AppSettings("E mpLogin"))
> > Dim Cmd as New SQLCommand(MySQL, MyConn)
> > cmd.CommandType=CommandType.StoredProcedure
> > cmd.parameters.add(New SQLParameter("@Login", txtUID.text))
> > cmd.parameters.add(New SQLParameter("@Password", txtPWD.text))
> > cmd = New SqlCommand(MySQL, MyConn)
> > MyConn.Open()
> > dr = cmd.ExecuteReader()
> >
> > But on that last line (executeReader), I get this error:
> > Procedure 'spGetEmployee' expects parameter '@Login', which was not>> >
> > What am I doing wrong?
> >
> >
>
Jerry Guest



Reply With Quote

