请问各位大虾,好想SQL语句没有什么错的,为什么我这程序在运行中会出现错误,请赐教!!!!
谢谢……
    //如果没有WHERE查询子句形成的话,则形成,则形成WHERE
    //查询子句,并保存一份副本在变量temp_string中
    temp_string = this.textBoxoption.Text + this.comboBoxlogic1.Text + temp_text;
    sql_string = this.comboBoxkey.Text + this.comboBoxlogic1.Text + temp_text; 
       m_nSqlstring = "SELECT * FROM stutable WHERE '" + sql_string +"'";
       if(search1.m_nSqlstring != "")
       {
SqlConnection yzCon = new SqlConnection(yzconn);
SqlDataAdapter yzcomm = new SqlDataAdapter(search1.m_nSqlstring ,yzCon); DataSet ds = new DataSet();
yzcomm.Fill(ds);
DataView source = new DataView(ds.Tables[0]);
dataGrid1.DataSource = source;
dataGrid1.SetDataBinding(m_dataset,"stutable");
        }

解决方案 »

  1.   

    没有,数据库是已经连接的了。这个是其中的部分代码。。
    是不是m_nSqlstring变量中的格式有问题呀 ?????
      

  2.   

    没有,数据库是已经连接的了。这个是其中的部分代码。。
    是不是m_nSqlstring变量中的格式有问题呀 ?????
      

  3.   

    設一下斷點,看sql_string,temp_string的值是不是正確的。