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.

Recommended Answers

All 2 Replies

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

Ok cool.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.