回复 3楼 laoyang103
private void GoodsList_Load(object sender, EventArgs e)//这是窗体加载事件
{
string sql = string.Forma(@"Select goodsinfo.id,typename,code,name,model,module,cost,money,earnings
from goodstype,goodsinfo where goodstype.id=goodsinfo.typeid");//这里是多表联查
ad = new SqlDataAdapter(sql, conn);
ad.Fill(ds, "goodsinfo");
ad.Fill(ds, "goodstype");//有位高手告诉我多加一句这个,说是两个表一起的,个人认为很没必要
dgvInfo.DataSource = ds.Tables["goodsinfo"];
}
private void btnUpdate_Click(object sender, EventArgs e)//这是更新按钮
{
SqlCommandBuilder builder = new SqlCommandBuilder(ad);
ad.Update(ds, "goodsinfo");//在这里报错了
MessageBox.Show("保存成功!");
}