请高手指导为何s不显示行数,最后未通过审查条数都是零条。哪里错了么?求指导,我是菜菜鸟
protected void btn_Check_Click(object sender, EventArgs e)
{
string tb = "";
tb = bd.Table_Detail(ddl_foreign.SelectedIndex);
string lg = bd.IsTable(tb);
//未通过审查的词条数
string sqlStr1 = "select Chinese," + lg + ",operation,state,username from " + tb
+ " where state = '未通过审查' and username = '"+Session["Name"].ToString()+"'";
SqlCommand cmd = new SqlCommand();
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["constr"].ToString());
con.Open();
cmd.CommandText = sqlStr1;
cmd.Connection = con;
int s = cmd.ExecuteNonQuery();
int j = 0;
if (s > 0)
{
j = s;
}
else
{
j = 0;
}
con.Close();
//Gridview显示
string sqlStr = "select Chinese as 中文,"+lg+" as 外文,operation as 操作,state as 审查状态,username as 用户名 from "+tb
+" where state !='' and username='"+Session["Name"].ToString()+"'";
//tb = bd.Table_Detail(ddl_foreign.SelectedIndex);
SqlConnection myConn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["constr"].ToString());
SqlDataAdapter myAdapter = new SqlDataAdapter(sqlStr,myConn);
DataSet myds = new DataSet();
myConn.Open();
myAdapter.Fill(myds);
GridView_gj.DataSource = myds;
int i = myds.Tables[0].Rows.Count;
int w = i - j;
Label1.Text = w.ToString();//待审查
&nbs