SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);','附近发生语法错误,哪错了
我是从另一个页面的gridview控件中通过点击infotitle的链接来传递ID值到该页面获取该ID,求大神解答啊if(!IsPostBack){if(Request[...
我是从另一个页面的gridview控件中通过点击infotitle的链接来传递ID值到该页面获取该ID,求大神解答啊
if (!IsPostBack)
{
if (Request["ID"] != null)//修改操作
{
int nid = int.Parse(Request["ID"].ToString());
SqlConnection conn = new SqlConnection("Data Source=MICROSOF-0EB1C6;Initial Catalog=shijin;Integrated Security=True");
SqlCommand cmd = new SqlCommand("select (infotitle,infomsg,lostadd,contactadd,contactperson,mobile,qq) from lostinfo where [ID]=nid", conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (dr.Read())
{
this.TextBox1.Text =dr["infotitle"].ToString();
this.TextBox2.Text =dr["infomsg"].ToString();
this.TextBox3.Text =dr["lostadd"].ToString();
this.TextBox4.Text =dr["contactadd"].ToString();
this.TextBox5.Text =dr["contactperson"].ToString();
this.TextBox6.Text =dr["mobile"].ToString();
this.TextBox8.Text =dr["qq"].ToString();
} 展开
if (!IsPostBack)
{
if (Request["ID"] != null)//修改操作
{
int nid = int.Parse(Request["ID"].ToString());
SqlConnection conn = new SqlConnection("Data Source=MICROSOF-0EB1C6;Initial Catalog=shijin;Integrated Security=True");
SqlCommand cmd = new SqlCommand("select (infotitle,infomsg,lostadd,contactadd,contactperson,mobile,qq) from lostinfo where [ID]=nid", conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (dr.Read())
{
this.TextBox1.Text =dr["infotitle"].ToString();
this.TextBox2.Text =dr["infomsg"].ToString();
this.TextBox3.Text =dr["lostadd"].ToString();
this.TextBox4.Text =dr["contactadd"].ToString();
this.TextBox5.Text =dr["contactperson"].ToString();
this.TextBox6.Text =dr["mobile"].ToString();
this.TextBox8.Text =dr["qq"].ToString();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询