string strJet ="Provider=Microsoft.Jet.OLEDB.4.0; Persist Security Info=False; Data Source=" + Server.MapPath("db1.mdb");
OleDbConnection  myconn = new OleDbConnection( strJet );
string strSql = "select password from userss where name=" + TextBox3.Text;
OleDbCommand     cmd  = new OleDbCommand(strSql, myconn );
OleDbDataAdapter da   = new OleDbDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
myconn.Close();
DataTable msgrep=ds.Tables[0];
Label2.Text=Convert.ToString(msgrep.Rows[0][0]);在执行da.Fill(ds)时说抽出条件的数据类型不一致,这是怎么回事呀

解决方案 »

  1.   

    "select password from userss where name=" + TextBox3.Text;"select password from userss where name=\"" + TextBox3.Text + "\"";
      

  2.   

    "select password from userss where name='" + TextBox3.Text + "'";
      

  3.   

    你的sql一定有问题
    要按access的语法来写