c# - Insert data in LINQ Database -
i wonder why can't insert data database using linq. created serviced-base database.
when run program, there no error, still no data appears in database table.
private void button1_click(object sender, eventargs e) { dataclasses1datacontext ds = new dataclasses1datacontext(); customer cst = new customer(); cst.custname = textboxnama.text; cst.phone = int.parse(textboxhp.text); cst.custaddress = textboxalamat.text; ds.customers.insertonsubmit(cst); try { ds.submitchanges(); messagebox.show("success"); } catch (exception ) { throw; } }
please check if connected correct database(check connection string).
Comments
Post a Comment