日期:2014-05-17 浏览次数:20833 次
public partial class bm : Form
{
public bm()
{
InitializeComponent();
}
DataBase db = new DataBase(); //自行开发的数据库连接类,保证没问题
DataSet ds = new DataSet();
SqlDataAdapter da;
DataRow dr;
SqlCommandBuilder scb;
private void bm_Load(object sender, EventArgs e)
{
db.Open();
da = new SqlDataAdapter("select * from bm", db.con);
da.Fill(ds);
scb = new SqlCommandBuilder(da);
dataGridView1.DataSource = ds.Tables[0];
}
private void bm_FormClosed(object sender, FormClosedEventArgs e)
{
db.Close();
}
private void 存盘按钮_Click(object sender, EventArgs e)
{
da.Update(ds);
}
}