Results 1 to 3 of 3

Thread: [RESOLVED] Syntax error (missing operator) in query expression 'Surname Arshad'.

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2011
    Posts
    6

    Resolved [RESOLVED] Syntax error (missing operator) in query expression 'Surname Arshad'.

    Code:
     Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
    
            Dim cmd As New OleDbCommand("SELECT * FROM tblContacts where Surname " & txtSurname.Text & "", con)
    
            dr = cmd.ExecuteReader
    
            If dr.HasRows Then
                dr.Read()
    
                txtfirstName.Text = dr("Surname")
            End If
    
    
    
        End Sub

  2. #2
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: Syntax error (missing operator) in query expression 'Surname Arshad'.

    "SELECT * FROM tblContacts where Surname = '" & txtSurname.Text & "'"

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2011
    Posts
    6

    Re: Syntax error (missing operator) in query expression 'Surname Arshad'.

    Quote Originally Posted by TysonLPrice View Post
    "SELECT * FROM tblContacts where Surname = '" & txtSurname.Text & "'"
    Thank you so much

    This was the thread I made: Link But somehow the code got seperated

    Anyway thanks again, All is working fine now and now I know where I went wrong

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width