我希望更新用户提供的详细信息,例如表格中的姓名,地址......等,以及在gridview中显示。
这样我就可以在gridview本身编辑/更新
string s = Session["something"].ToString();
string str=string.Empty;
//bool bNextResult;
SqlConnection con = new SqlConnection("server=AMRNDHW1995\\DEV1;UID=POMS_ZOETIS_D_RO;PWD=12Werty@; database=POMS_Zoetis_D;");
SqlCommand cmd = new SqlCommand("select amount from budget_detail where year='" + s + "'", con);
SqlDataReader dr;
con.Open();
dr = cmd.ExecuteReader();
SqlDataAdapter da = new SqlDataAdapter(cmd);
//DataSet ds =new DataSet();
//da.Fill(ds);
//while (bNextResult == true)
//{
while (dr.Read())
{
str += dr.GetValue(0).ToString()
+"\n";
答案 0 :(得分:0)
DataRow DR = dtTable.NewRow();
DR["Name"]=TxtName.Text;
DR["Age"]=TxtAge.Text;
DR["Place"]=TxtPlace.Text;
dtTable.adtTable.Rows.Add(DR);
dataGridView1.DataSource = dtTable;