c# - How to Insert label value into MS Access Database -


i tried inserting label value ms access codes below keep getting "syntax error in insert statement". please help. thanks

    private void button1_click(object sender, eventargs e)     {         label2.text = "born win";         label4.text = "£10";          connection = new oledbconnection(@"provider=microsoft.ace.oledb.12.0;data source =c:\users\kunle\documents\winners app\winnersbookshop.accdb;persist security info=false");         connection.open();          oledbcommand command = new oledbcommand();         command.connection = connection;          try         {              command.commandtext = "insert transaction([title], [price]) values('" + label2.text + "','" + label4.text + "')";             command.commandtype = commandtype.text;              command.executenonquery();              messagebox.show("successfully");           }          catch (exception r)         {             messagebox.show("unsuccesssful" + r);          } 


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -