62,041
社区成员
发帖
与我相关
我的任务
分享
else if (j == 1)
{
test += "<td>" + "<a href=detail.aspx?hid=" + ds.Tables[0].Rows[i][0] + " target=" + "_blank" + ">" + ds.Tables[0].Rows[i][1].ToString() + "</a>" + "</td>";
}
这里循环有问题
你可以 生成后 打开调试工具(浏览器一般都有 F12打开) 然后看看页面的代码 和你想的是否一样
这段代码是为了点击超链接时刷新页面同时更新一些参数的,hid是数据库中的主键
#region 载入时显示
if (Request["del_id"] != null)
{
string a = Request["del_id"];
SqlConnection conn = new SqlConnection(DBAccess.StrConn);
conn.Open();
string sql = "DELETE FROM [HomeEduInfo] WHERE hID=" + a;
SqlCommand comm = new SqlCommand();
comm.Connection = conn;
comm.CommandText = sql;
comm.ExecuteNonQuery();
conn.Close();
}
//...aspx?hid=32&op=1
if (Request["hid"] != null)
{
string b = Request["hid"];
SqlConnection conn1 = new SqlConnection(DBAccess.StrConn);
conn1.Open();
if (Request["op"] == "1")
{
string sql1 = "UPDATE [weiqi].[dbo].[HomeEduInfo] SET hStatus =1 where hid=" + b;
SqlCommand cmd = new SqlCommand(sql1, conn1);
cmd.ExecuteNonQuery();
}
else
{
string sql1 = "UPDATE [weiqi].[dbo].[HomeEduInfo] SET hStatus =0 where hid=" + b;
SqlCommand cmd = new SqlCommand(sql1, conn1);
cmd.ExecuteNonQuery();
}
这段代码调试下 问题应该在这里。。