public bool them(BXHDTO bxh) { string query = string.Empty; query += "INSERT INTO [bangxephang] ([MaBXH], [NgayGio])"; query += "VALUES (@MaBXH,@NgayGio)"; using (SqlConnection con = new SqlConnection(ConnectionString)) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = query; cmd.Parameters.AddWithValue("@MaBXH", bxh.MaBXH); cmd.Parameters.AddWithValue("@NgayGio", bxh.NgayGio); try { con.Open(); cmd.ExecuteNonQuery(); con.Close(); con.Dispose(); } catch (Exception ex) { con.Close(); return(false); } } } return(true); }
public bool them(BXHDTO bxh) { bool re = bxhDAL.them(bxh); return(re); }