T
Traveller
Unregistered / Unconfirmed
GUEST, unregistred user!
我该怎样用DataBind的方式插入数据呢?我在Page_Load中绑定了数据并且插入了新行,结果到了btnSubmit_Click中这个DataSet就空了。
代码如下:
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
connPSXT.Open();
daSeller.Fill(dsSeller);
dsSeller.Tables["Seller"].Rows.Add(dsSeller.Seller.NewRow());
Page.DataBind();
connPSXT.Close();
}
}
private void btnSubmit_Click(object sender, System.EventArgs e)
{
connPSXT.Open();
lblCount.Text = dsSeller.Tables["Seller"].Rows.Count.ToString();
daSeller.Update(dsSeller, "Seller"
connPSXT.Close();
}
代码如下:
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
connPSXT.Open();
daSeller.Fill(dsSeller);
dsSeller.Tables["Seller"].Rows.Add(dsSeller.Seller.NewRow());
Page.DataBind();
connPSXT.Close();
}
}
private void btnSubmit_Click(object sender, System.EventArgs e)
{
connPSXT.Open();
lblCount.Text = dsSeller.Tables["Seller"].Rows.Count.ToString();
daSeller.Update(dsSeller, "Seller"
connPSXT.Close();
}