c# 数据库查询返回值问题
sql语句是:stringsql="SELECTPASSWORDFROMUSERSWHEREUSERID='"+uid+"'";如何用C#语言,获得这个PASSWORD值...
sql语句是:
string sql = "SELECT PASSWORD FROM USERS WHERE USERID='" + uid + "'";
如何用C#语言,获得这个PASSWORD值? 展开
string sql = "SELECT PASSWORD FROM USERS WHERE USERID='" + uid + "'";
如何用C#语言,获得这个PASSWORD值? 展开
展开全部
string sql = "SELECT PASSWORD FROM USERS WHERE USERID='" + uid + "'";
con.Open();
SqlCommand cmd = new SqlCommand(sqlstr, con);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
这里就是读到了哈,
reader[0].tostring()就是我们的password哈
}
con.Open();
SqlCommand cmd = new SqlCommand(sqlstr, con);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
这里就是读到了哈,
reader[0].tostring()就是我们的password哈
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询