我的DataGrid的数据是通过DataSet中Datatable里面来的。现在连接已经断开了。我想问一下,如果我对DataGrid进行了修改后,我把整个表进行UPDATA该如何做啊!!!请用写代码的方式告诉我(ADO.NET不要绑定控件来实现),我等着要
解决方案 »
- 皮肤控件问题!!
- C# System.net
- C#中怎么更改图片的颜色
- 如何把DataGridView中的cell格式全部变成RadioButton格式,他默认没有这种格式,谢谢。。
- 仅有的17分,谁能帮我解决这个小问题,C#
- 为什么 visual studio 2005 不可以像 2003那样把控件随便拖放?
- udpsend()方法,服务器能否使用该方法发送给客户机
- ActiveReport.Net中,如何计算总页数?
- URL参数随机生成后加密
- 请问如何实现程序在失去焦点的情况(后台)下控制鼠标。
- 在WEB中,C#下用什么样的第三方控件,达到设计美观,开发简易.
- 在while(true)中要显示另一个form的问题。
{
switch(((LinkButton)e.CommandSource).CommandName)
{
case "Insert":
if(((TextBox)e.Item.FindControl("InsertContent")).Text!="")
{
String sql_add = "INSERT INTO _List_Status (StatusName)VALUES('"+((TextBox)e.Item.FindControl("InsertContent")).Text+"')";
SqlCommand sqlCommandInsert = new SqlCommand(sql_add,conn);
sqlCommandInsert.ExecuteNonQuery(); People.EditItemIndex = -1;
People.DataSource = CreateDataSource();
People.DataBind();
}
break;
case"Cancel":
People.EditItemIndex = -1;
People.DataSource = CreateDataSource();
People.DataBind();
break;
case"Edit":
People.EditItemIndex = e.Item.ItemIndex;
People.DataSource = CreateDataSource();
People.DataBind();
break;
case"Update":
string StatusName = ((TextBox)e.Item.Cells[1].Controls[1]).Text;
String sql_edit = "UPDATE _List_Status " +
"SET StatusName = '" + StatusName + "'" +
" WHERE StatusId = " + e.Item.Cells[0].Text; SqlCommand sqlCommandUpdate = new SqlCommand(sql_edit,conn);
sqlCommandUpdate.ExecuteNonQuery(); People.EditItemIndex = -1;
People.DataSource = CreateDataSource();
People.DataBind();
break;
case"Delete":
String sql_Del = "DELETE FROM _List_Status " +
" WHERE StatusId = " + e.Item.Cells[0].Text;
SqlCommand sqlCommandDel = new SqlCommand(sql_Del,conn);
sqlCommandDel.ExecuteNonQuery(); People.EditItemIndex = -1;
People.DataSource = CreateDataSource();
People.DataBind();
break;
default:
break;
}
}