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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

VB SQL statement problem

  • 14-05-2004 8: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, Registered Users 2 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


Welcome!

It looks like you're new here. Sign in or register to get started.
Advertisement