Clsprovider: @"data Source ./sqlexpress Initial Catalog Qlhocsinh Integrated Security True"
Clsprovider: @"data Source ./sqlexpress Initial Catalog Qlhocsinh Integrated Security True"
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
namespace QLHS
{
class clsProvider
{
data = cmd.ExecuteNonQuery();
con.Close();
return data;
}
}
}
-------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace QLHS
{
public partial class frmLop_p : Form
{
//string sSelect = @"Select * FROM Lop Where Tenlop = @Tenlop";
string sSelect = @"Select * FROM Lop";
bool isSua = false;
public frmLop_p()
{
InitializeComponent();
}
dgvLop.Columns[0].Width = 100;
dgvLop.Columns[1].Width = 300;
dgvLop.Columns[2].Width = 100;
//DataGridViewRow r = dgvLop.SelectedRows[0];
//txtMalop.Text = r.Cells["MALOP"].Value.ToString();
//txtTenlop.Text = r.Cells["TENLOP"].Value.ToString();
//txtSiso.Text = r.Cells["SISO"].Value.ToString();
btnThem.Enabled = true;
btnXoa.Enabled = true;
btnSua.Enabled = true;
btnHuy.Enabled = false;
btnLuu.Enabled = false;
btnThem.Enabled = false;
btnXoa.Enabled = false;
btnSua.Enabled = false;
btnHuy.Enabled = true;
btnLuu.Enabled = true;
txtMalop.ReadOnly = false;
txtTenlop.ReadOnly = false;
txtSiso.ReadOnly = false;
}
LoadData();
}
}
btnThem.Enabled = false;
btnXoa.Enabled = false;
btnSua.Enabled = false;
btnHuy.Enabled = true;
btnLuu.Enabled = true;
}
btnThem.Enabled = true;
btnXoa.Enabled = true;
btnSua.Enabled = true;
btnHuy.Enabled = false;
btnLuu.Enabled = false;
txtMalop.ReadOnly = true;
txtTenlop.ReadOnly = true;
txtSiso.ReadOnly = true;
}
if (data > 0)
{
MessageBox.Show("Lưu thành công");
LoadData();
}
else MessageBox.Show("Lưu thất bại");
btnThem.Enabled = true;
btnXoa.Enabled = true;
btnSua.Enabled = true;
btnHuy.Enabled = false;
btnLuu.Enabled = false;
txtMalop.ReadOnly = true;
txtTenlop.ReadOnly = true;
txtSiso.ReadOnly = true;