0

hello, i'm new here and i'm also new in VB.Net and SQL Server 2008. I just got this error while creating my own login form. It generates an error "Invalid Column name manoyanx" where 'manoyanx' is the string i am querying in the database. Here is my snippet :

Dim connetionString As String
        Dim cnn As SqlConnection
        Dim mycomm As SqlCommand = New SqlCommand
        Dim dr As SqlClient.SqlDataReader

        connetionString = "Integrated Security=SSPI;Data Source=" & row(col) & "\SQLEXPRESS" & ";Initial Catalog=PIMS;"
        cnn = New SqlConnection(connetionString)
        cnn.Open()

        mycomm.Connection = cnn
        mycomm.CommandType = CommandType.Text
        mycomm.CommandText = "Select * From tbl_staff where username = " & txtUser.Text

        dr = mycomm.ExecuteReader

the highlighted line of the code is dr = mycomm.ExecuteReader

i hope someone can clarify this to me.

2
Contributors
2
Replies
6
Views
6 Years
Discussion Span
Last Post by jbisono
0

darn, i found it, i just forgot those tiny little single quotes in my query. (^^,)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.