Stored Procedure/Parameter problem

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?
 
J

Jerry

Marina is correct. You can also just comment out cmd = New SqlCommand(MySQL,
MyConn)
line of code.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top