public bool them(VongThiDauDTO vtd) { string query = string.Empty; query += "INSERT INTO [vongthidau] ([MaVongDau], [TenVongDau])"; query += "VALUES (@MaVongDau,@TenVongDau)"; 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("@MaVongDau", vtd.MaVongDau); cmd.Parameters.AddWithValue("@TenVongDau", vtd.TenVongDau); try { con.Open(); cmd.ExecuteNonQuery(); con.Close(); con.Dispose(); } catch (Exception ex) { con.Close(); return(false); } } } return(true); }
public bool them(VongThiDauDTO vtd) { bool re = vtdDAL.them(vtd); return(re); }