datagrid中TextBox控件使用和数据更新问题
为何数据不更新?帮我看看有何错误?
private void calculate_Click(object sender, System.EventArgs e)
{
for(int i=0;i<order.Items.Count;i++)
{
TextBox tb=(TextBox)order.Items[i].FindControl("Quantity");
int qt=Convert.ToInt32(tb.Text);
string ud=(string)Session["userid"];
string od=(string)Session["OrderID"];
SqlConnection myConnection=new SqlConnection("user id=sa;pwd=761110;initial catalog=xjuser");
string sql="update Order1 set Quantity='"+qt+"' where OrderID='"+od+"'and userid='"+ud+"'";
SqlDataAdapter myCommand=new SqlDataAdapter(sql,myConnection);
DataSet ds=new DataSet();
myCommand.Fill(ds,"aa");
DataTable dt=ds.Tables["aa"];
string s="select * from Order1 where OrderID='"+od+"'and userid='"+ud+"'";
SqlDataAdapter com=new SqlDataAdapter(s,myConnection);
DataSet ds2=new DataSet();
com.Fill(ds2,"as");
DataTable dt2=ds2.Tables["as"];
order.DataSource=dt2;
order.DataBind();
}
}