Esempio n. 1
0
 private void addData(NhanVienObj nv)
 {
     nv.MaNv     = txtmanv.Text.Trim();
     nv.DiaChi   = txtdiachi.Text.Trim();
     nv.Sdt      = txtsdt.Text.Trim();
     nv.TenNv    = txttennv.Text.Trim();
     nv.NgaySinh = dtpns.Text;
     nv.GioiTinh = cmbgt.Text.Trim();
     nv.MaCv     = ConnectToSql.GetFieldValues("SELECT MACV FROM CONGVIEC WHERE TENCV = N'" + cmbmacv.Text + "'");
 }
Esempio n. 2
0
 private void addData(MatHangObj mh)
 {
     mh.MaMh   = txtmamh.Text.Trim();
     mh.TenMh  = txttenmh.Text.Trim();
     mh.Cd     = ConnectToSql.GetFieldValues("SELECT MACD FROM CONGDUNG WHERE TENCD= N'" + cmbcd.Text + "'");
     mh.Cl     = ConnectToSql.GetFieldValues("SELECT MACL FROM CHATLIEU WHERE TENCL= N'" + cmbcl.Text + "'");
     mh.Dgb    = txtdgb.Text.Trim();
     mh.Dgn    = txtdgn.Text.Trim();
     mh.Dl     = ConnectToSql.GetFieldValues("SELECT MADL FROM DUNGLUONG WHERE TENDL= N'" + cmbdl.Text + "'");
     mh.GhiChu = txtgc.Text.Trim();
     mh.Hd     = ConnectToSql.GetFieldValues("SELECT MAHD FROM HINHDANG WHERE TENHD= N'" + cmbhd.Text + "'");
     mh.Loai   = ConnectToSql.GetFieldValues("SELECT MAL FROM LOAI WHERE TENL= N'" + cmbloai.Text + "'");
     mh.Mau    = ConnectToSql.GetFieldValues("SELECT MAM FROM MAUSAC WHERE TENM= N'" + cmbmau.Text + "'");
     mh.Ncc    = ConnectToSql.GetFieldValues("SELECT MANCC FROM NHACC WHERE TENNCC= N'" + cmbncc.Text + "'");
     mh.Nd     = ConnectToSql.GetFieldValues("SELECT MADO FROM DORUOU WHERE TENDO= N'" + cmbnd.Text + "'");
     mh.Nsx    = ConnectToSql.GetFieldValues("SELECT MANSX FROM NUOCSX WHERE TENNSX= N'" + cmbnsx.Text + "'");
     mh.Tgbh   = txttgbh.Text.Trim();
     mh.Sl     = txtsl.Text.Trim();
 }
 private void SomeMethod(object sender, EventArgs e)
 {
    ConnectToSql connToSql = new ConnectToSql(); // Instantiate the new class here.
    connToSql.SqlConnection();  // Use the new class
 }
 private void button1_Click(object sender, EventArgs e)
 {
     ConnectToSql connToSql = new ConnectToSql();
     connToSql.SqlConnection();
 }