نوشته شده توسط
ehsan7007
کد ذخیرت رو بنویس .
if (Conn.State == ConnectionState.Open)
Conn.Close();
//set sqlcommand connection
//Assign the command to insert data in to the database
SqlCommand Comm = new SqlCommand("Insert Into t_shift(sh_title,sh_start,sh_end,sh_time,sh_costPe rHour" +
",sh_costWhole,sh_desc,[sh-UserName])values(@sh_title,@sh_start,@sh_end,@sh_time," +
"@sh_costPerHour,@sh_costWhole,@sh_desc,@[sh-UserName])", Conn);
Comm.Parameters.Add("@sh_title", txtCaption.Text.ToString());
Comm.Parameters.Add("@sh_start", txtStart.Text.ToString());
Comm.Parameters.Add("@sh_end", txtFinish.Text.ToString());
Comm.Parameters.Add("@sh_time", txtTime.Text.ToString());
Comm.Parameters.Add("@sh_costPerHour", Int32.Parse(txtPricePfTime.Text));
Comm.Parameters.Add("@sh_costWhole", txtAllPrice.Text.ToString());
Comm.Parameters.Add("@sh_desc", txtCommand.Text.ToString());
Comm.Parameters.Add("@[sh-UserName]", cmbUser.Text.ToString());
Conn.Open();
Comm.ExecuteNonQuery();
Conn.Close();
Conn کانکشنم هست.