Stored Procedure/Parameter problem

  • Thread starter Thread starter ElmoWatson
  • Start date Start date
E

ElmoWatson

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("EmpLogin"))
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?
 
Marina is correct. You can also just comment out cmd = New SqlCommand(MySQL,
MyConn)
line of code.
 
Back
Top