sql server - c#: Error on running the code -
while running code after successful compilation, have error
incorrect syntax near keyword 'end'.
though code formatted have error. someone, please me rectify problem. code below;
using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.data.sqlclient; namespace order { public partial class form2 : form { public form2() { initializecomponent(); } sqlconnection abc = new sqlconnection(@"data source=ipc\sqlexpress;initial catalog=nml;integrated security=true"); sqlcommand command = new sqlcommand(); //sqldatareader dataread = new sqldatareader(); private void button1_click(object sender, eventargs e) { abc.open(); command.commandtext = "insert tbl_rec(qcode,warp,ply,blend,tends,warp1,weft,end,pick,,width,weave1,weave2,tl) values('" + textbox2.text + "','" + textbox3.text + "','" + textbox4.text + "','" + textbox5.text + "','" + textbox6.text + "','" + textbox7.text + "','" + textbox8.text + "','" + textbox9.text + "','" + textbox10.text + "','" + textbox11.text + "','" + textbox12.text + "','" + textbox13.text + "','" + textbox14.text + "')"; command.connection = abc; command.executenonquery(); abc.close(); messagebox.show("data saved successfully"); textbox2.clear(); textbox3.clear(); textbox4.clear(); textbox5.clear(); textbox6.clear(); textbox7.clear(); textbox8.clear(); textbox9.clear(); textbox10.clear(); textbox11.clear(); textbox12.clear(); textbox13.clear(); textbox14.clear(); datetimepicker1.value = datetime.now; } private void form2_load(object sender, eventargs e) { command.connection = abc; } } }
your problem here in insert query. using 2 time coma should one.
,end,pick,,width,
Comments
Post a Comment