Hello,
I have some code:
I keep getting: Invalid column name 'lisa'.
lisa is one of the Employee ID's... the minute I delete that from my table and deal only with numbers, for instance, 1111111 as the Employee ID, my code is fine-- It's a SQL thing I think, (I posted there too) but I'm thinking it's the way I'm calling the Employee ID- is Char okay to use? Why is it as soon as I have alphanumeric characters I get that message????
Thanks!
I have some code:
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
End If
'Define connection to read the data
Dim myConn As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim MyCmd As New SqlCommand("SELECT EmployeeID, Password From tblVendorLogin Where EmployeeID = " & Request.Cookies("SKUPM")("EmpID"), myConn)
MyCmd.CommandType = CommandType.Text
MyCmd.Parameters.Add(New SqlParameter("@EmployeeID", SqlDbType.VarChar, 7)).Value = Convert.ToString(EmployeeID)
myConn.Open()
Dim Result As SqlDataReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)
Result.Read()
If Not Result.IsDBNull(0) Then
EmployeeID.Text = Result("EmployeeID").ToString()
End If
If Not Result.IsDBNull(0) Then
txtCurrent.Text = Result("Password").ToString()
End If
End Sub
I keep getting: Invalid column name 'lisa'.
lisa is one of the Employee ID's... the minute I delete that from my table and deal only with numbers, for instance, 1111111 as the Employee ID, my code is fine-- It's a SQL thing I think, (I posted there too) but I'm thinking it's the way I'm calling the Employee ID- is Char okay to use? Why is it as soon as I have alphanumeric characters I get that message????
Thanks!