try { DataSet ds=new DataSet(); connection.Open(); cmd = new SqlCommand(); cmd.Connection = connection; dadapter = new SqlDataAdapter(); dadapter.InsertCommand= connection.CreateCommand(); dadapter.InsertCommand.CommandText = "insert into contacts (CName,CNumber,Address) values(@CName,@Number,@Address)"; cmd.Parameters.AddWithValue("@CName", textBox1.Text); cmd.Parameters.AddWithValue("@CNumber",textBox2.Text); cmd.Parameters.AddWithValue("@Address",textBox3.Text); MessageBox.Show("Record Saved", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); connection.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)