SqlConnection sqlcon = new SqlConnection(@"Server=ADMIN-PC\SQLEXPRESS;Database=ELMANAR; Integrated Security = True");
SqlDataAdapter da;
DataTable dt1 = new DataTable();
Data_Access_Layer.DataAccessLayer DAL = new Data_Access_Layer.DataAccessLayer();
SqlCommand cmd = new SqlCommand();
private void btnsave_Click(object sender, EventArgs e)
{
try
{
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlcon;
cmd.CommandText = "insert into TBL_CATEGORYCUSTOMERS (catcustomer_id,catcustomer_name,catcustomer_note) values ('" + txtid.Text + "','" + txtname.Text + "','" + txtnote.Text + "')";
sqlcon.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("Saved");
sqlcon.Close();
dt1.Clear();
da.Fill(dt1);
btnsave.Enabled = false;
btnadd.Enabled = true;
txtid.Clear();
txtname.Clear();
txtnote.Clear();
}
catch { }
تم تعديل هذه المشاركة بواسطة a.ss.suliman في 2 ديسمبر 2014 في 23:20