我想回到一個確定年代,其中應包括一個字符串,返回一個確定年代的時候手動添加一個字符串,下面是我使用的代碼:我要添加密碼返回的數據表和一個字符串
static public DataTable GetInfoByCode(string code, string user)
{
string sql = "SELECT aspnet_Users.UserName, " +
"Code.dateUsed" +
"FROM aspnet_Membership INNER JOIN" +
"aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId INNER JOIN"+
"rAccessCode ON aspnet_Users.UserId = rAccessCode.userID INNER JOIN"+
"Code ON rAccessCode.CodeID = Code.accessCodeID"+
"WHERE (Code.accessCode = code)";
MembershipUser userPass = Membership.GetUser(user);
string password = userPass.GetPassword();
SqlDataAdapter da = new SqlDataAdapter(sql, ConnectionString);
DataTable dt = new DataTable();
da.Fill(dt);
return dt; //want to return password field in the dt so that i can link datasource with datagridview and show password and username in gridview
}
讓我像數據網格視圖取回密碼字段DT:
<asp:GridView ID="gvList" runat="server" >
<Columns>
<asp:BoundField DataField="UserName" ReadOnly="True" HeaderText="Username" />
<asp:BoundField DataField="password" ReadOnly="True" HeaderText="Password" />
</Columns>
</asp:GridView>
是密碼散列或明文? – 2012-07-19 11:46:21
密碼被散列 – 2012-07-19 12:08:32
你不能以明文形式顯示散列密碼,所以你想顯示什麼? – 2012-07-19 12:10:34