
asp.net请高手帮忙看下这段代码错在哪了,该怎么改?
stringqq;qq=Convert.ToString(Application["ss"]);if(qq!="游客"){mingcheng=Convert.ToStri...
string qq;
qq = Convert.ToString(Application["ss"]);
if (qq != "游客")
{
mingcheng = Convert.ToString(Application["mingcheng"]);
SqlConnection sql = new SqlConnection("server=.;database=shouji;integrated security = true");
string ss = "update shangpin set bj=" + 1 + " where mingcheng='" + mingcheng + "'";
SqlCommand comm = new SqlCommand(ss, sql);
sql.Open();
comm.ExecuteNonQuery();
sql.Close();
SqlConnection coon = new SqlConnection("server=.;database=shudian;integrated security = true");
SqlCommand cmd = new SqlCommand("select * from shangpin where bj =" + 1 , coon);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "spb");
GridView1.DataSource = ds;
GridView1.DataBind();
}
else
{
Response.Write("<script >window.alert('请先登陆!'); top.location='hydl.aspx'; </script>");
}
调试的适合没问题,但运行的时候有错误:列名bj无效 展开
qq = Convert.ToString(Application["ss"]);
if (qq != "游客")
{
mingcheng = Convert.ToString(Application["mingcheng"]);
SqlConnection sql = new SqlConnection("server=.;database=shouji;integrated security = true");
string ss = "update shangpin set bj=" + 1 + " where mingcheng='" + mingcheng + "'";
SqlCommand comm = new SqlCommand(ss, sql);
sql.Open();
comm.ExecuteNonQuery();
sql.Close();
SqlConnection coon = new SqlConnection("server=.;database=shudian;integrated security = true");
SqlCommand cmd = new SqlCommand("select * from shangpin where bj =" + 1 , coon);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "spb");
GridView1.DataSource = ds;
GridView1.DataBind();
}
else
{
Response.Write("<script >window.alert('请先登陆!'); top.location='hydl.aspx'; </script>");
}
调试的适合没问题,但运行的时候有错误:列名bj无效 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询