access 2007能连接上但读不出数据
OleDbConnection myConn = new OleDbConnection();myConn.ConnectionString = ConfigurationSettings.AppSettings["ConnStr"];
myConn.Open();
string strsql = "select GName,GPassword from [GLY] where GName=' + NameTextBox.Text'" ;
OleDbCommand cmd = new OleDbCommand(strsql, myConn);
OleDbDataReader dr;
dr = cmd.ExecuteReader();
if (dr.Read())
{
if (dr.GetValue(0).ToString ()==NameTextBox.Text)
{
if (dr.GetValue(1).ToString() == PasswordText.Text)
{
Response.Redirect("Default.aspx");
}
}
}
myConn.Close();
能连接上但读不出数据,谁知道是怎么回事?