Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB SQL statement problem

Options
  • 14-05-2004 9:21pm
    #1
    Closed Accounts Posts: 1,152 ✭✭✭


    hey all im having trouble getting this UPDATE SQL statement to execute in VB 6
    Private Sub cmdUpdate_Click()
    Dim strSql As String
    
    strSql = "Update tblCustomer" & "SET CustName = '" & txtName.Text & "' " & " WHERE CustNum = " & txtNum.Text
    
    cn.Execute strSql
    
    End Sub
    

    Any help would be much appreciated

    thanks


Comments

  • Closed Accounts Posts: 302 ✭✭Auburn


    What error does it give?


  • Registered Users Posts: 4,780 ✭✭✭JohnK


    When that string is joined there is no space between tblCustomer and SET. The statement you are sending to the database is "Update tblCustomerSET CustName..." and the database is unable to distinguish between the table name and the command you are passing.

    EDIT: Why do you have the string broken up so much? Why not just use:
    strSql = "Update tblCustomer SET CustName = '" & txtName.Text & "' WHERE CustNum = " & txtNum.text


Advertisement