日期:2014-05-18  浏览次数:20526 次

请问在gridview的编辑时自动获得ip并更新?
gridview中有一个IP列,我想在编辑更新时,自动获得ip,并进行更新,怎么做?

------解决方案--------------------
探讨
引用:
C# code
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conStr"]);
conn.Open();
string id = this.GridView1.DataKeys[e.NewSelectedIndex].Value.ToString();
SqlCommand cmd = new SqlCommand("select ip fro…