vb.net - Error: Syntax error in UPDATE statement -


the error while executing code below in oledb

        try             con.open()             dim cmd new oledbcommand("select * customer", con)             cmd.commandtext = " update customer set hr =@hr,min =@min "             cmd.parameters.addwithvalue("@hr", comboboxhr.selectedindex.tostring())             cmd.parameters.addwithvalue("@min", comboboxmin.selectedindex.tostring())             cmd.executenonquery()             twodigit(comboboxhr)             messagebox.show("conratulations! ...click start button see changes")         catch ex exception             messagebox.show(ex.message.tostring())         end try 

which works fine if remove "min" part. reason?

i believe aakashm right. can use keyword column name long put in []

try         con.open()         dim cmd new oledbcommand("select * customer", con)         cmd.commandtext = " update customer set hr =@hr,[min] =@min "         cmd.parameters.addwithvalue("@hr", comboboxhr.selectedindex.tostring())         cmd.parameters.addwithvalue("@min", comboboxmin.selectedindex.tostring())         cmd.executenonquery()         twodigit(comboboxhr)         messagebox.show("conratulations! ...click start button see changes")     catch ex exception         messagebox.show(ex.message.tostring())     end try 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -