public void updateModel(tblLinhVucModel linhVuc) { //string sql = "Update tblLinhVuc set TENLV=N'" + linhVuc.TenLinhVuc + "',GHICHU=N'" + linhVuc.GhiChu + "' where MALV='" + linhVuc.MaLinhVuc + "'"; //connectSer.ThucThiSQLTheoPhiKetNoi(sql); sqlCom = new SqlCommand(); sqlCom.CommandType = CommandType.StoredProcedure; sqlCom.CommandText = "USP_UpdateLinhVuc"; sqlCom.Parameters.Add("@MALV", SqlDbType.VarChar).Value = linhVuc.MaLinhVuc; sqlCom.Parameters.Add("@TENLV", SqlDbType.NVarChar).Value = linhVuc.TenLinhVuc; sqlCom.Parameters.Add("@GHICHU", SqlDbType.NVarChar).Value = linhVuc.GhiChu; sqlCom.Connection = connectSer.Connect(); sqlCom.ExecuteNonQuery(); }
public void createModel(tblLinhVucModel linhVuc) { //string sql = "Insert Into tblLinhVuc(MALV,TENLV,GHICHU) values ('" + linhVuc.MaLinhVuc + "',N'" + linhVuc.TenLinhVuc + "',N'" + linhVuc.GhiChu + "')"; //connectSer.ThucThiSQLTheoPhiKetNoi(sql); sqlCom = new SqlCommand(); sqlCom.CommandType = CommandType.StoredProcedure; sqlCom.CommandText = "USP_InsertLinhVuc"; sqlCom.Parameters.Add("@MALV", SqlDbType.VarChar).Value = linhVuc.MaLinhVuc; sqlCom.Parameters.Add("@TENLV", SqlDbType.NVarChar).Value = linhVuc.TenLinhVuc; sqlCom.Parameters.Add("@GHICHU", SqlDbType.NVarChar).Value = linhVuc.GhiChu; sqlCom.Connection = connectSer.Connect(); sqlCom.ExecuteNonQuery(); }