SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["OASystemconstr"].ConnectionString);
string str = "select id,departmentID,roleID,name,pwd from Users
where name=" + uname+ " and pwd=" + pwd + "";
SqlDataAdapter ada = new SqlDataAdapter(str, con);
DataSet ds = new DataSet();
ada.Fill(ds, "Users");//这里出错。
if (ds.Tables["Users"].Rows.Count > 0) //判断是否存在记录
{
//省略
}说明:我要操作的是用户登录,我用sql语句查出个人信息,包括用户名name,是中文的,
但是用户名和密码都对了,但提示列名无效。
string str = "select id,departmentID,roleID,name,pwd from Users
where name=" + uname+ " and pwd=" + pwd + "";
SqlDataAdapter ada = new SqlDataAdapter(str, con);
DataSet ds = new DataSet();
ada.Fill(ds, "Users");//这里出错。
if (ds.Tables["Users"].Rows.Count > 0) //判断是否存在记录
{
//省略
}说明:我要操作的是用户登录,我用sql语句查出个人信息,包括用户名name,是中文的,
但是用户名和密码都对了,但提示列名无效。
where name='" + uname+ "' and pwd='" + pwd + "'";
string str = "select id,departmentID,roleID,name,pwd from Users
where name='" + uname+ "' and pwd='" + pwd + "'";
呵呵,越学越笨了,追问下
datetime类型可以直接加入datetime类型的列吗???