刚学习.net,在网上发现都是03版vs的例子,请问一下有没有05 gridview下删除选定行的代码学习一下,谢谢了
解决方案 »
- winform 调用java webservice
- 请问网络问题
- [winform]如何比对本地文件与服务器文件不同
- *****正则表达式问题
- 如何使程序不在最前面(TopMost)?
- .net中excel的问题
- 如何在dataGrid中进行编辑,然后可以更新到数据源也就是数据库。
- 创建txt文件.并向里面写入string失败-----fputs?
- C#中还有没有逗号表达式啊?真不好用
- 高分请教高手,如何把一个treeview的结构保存到XML文件中,又如何从这个XML文件生成treeview?
- 这样的报表形式能做得到吗?
- 我寫了一個只有幾個屬性的類,用另一個類去調用,如何獲取該類的所有我定的屬性的名稱(C#,VB.net均可)....散分
{
string url = Request.Url.ToString();
if (null != Session["UserID"])
{
cSWUserId = Session["UserID"].ToString();
}
if (e.CommandName == "DeleteTheRecord")
{
Int32 startindex = Convert.ToInt32(e.CommandArgument);
DataKey keyValue = GridView1.DataKeys[startindex];
Int32 hubId = Convert.ToInt32(keyValue[0]);
Int32 appointmentId = Convert.ToInt32(keyValue[1]);
string clientid = keyValue[2].ToString();
Int32 doctorTypeID = Convert.ToInt32(keyValue[3]);
//执行删除操作
bFPHN.UpdatePhnAlert(cSWUserId, hubId, appointmentId, doctorTypeID);
}
}
供参考
{
string id = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
string connStr = System.Configuration.ConfigurationManager.AppSettings["strConn"].ToString();
string SqlStr = "delete from news where id=" + id; SqlConnection con = new SqlConnection(connStr);
con.Open();
DataSet myDataSet = new DataSet();
string sql = "select* from news where shifouchakan = 0";
SqlDataAdapter myCommand = new SqlDataAdapter(sql, con); //填充DataSet
myCommand.Fill(myDataSet); //关闭链接
GridView1.DataSource = myDataSet; //绑定
GridView1.DataBind();
}