SqlConnection sqlcon = new SqlConnection("DATA SOURCE=SERVER;Database=DISPATCH.MDF;Trusted_Connection=True;"); SqlCommand cmd; public frmClients() { InitializeComponent(); } private void btnSave_Click(object sender, EventArgs e) { try { sqlcon.Open(); SqlCommand cmd = new SqlCommand("Insert INTO tblContacts (CLIENTS) VALUES('" + textBox1.Text + "')"); cmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
SqlCommand cmd = new SqlCommand("Insert INTO tblContacts (CLIENTS) VALUES('" + textBox1.Text + "')",sqlcon);
Server=[SERVER];Database=[DATABASE];Trusted_Connection=True;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)