0
我建立窗口形式的應用程序中使用VS2010.On我的登錄表單收集USEID
和密碼,然後點擊登錄按鈕,如果驗證成功後直接
用戶的主要形式。
我想使用字典來存儲從數據庫中讀取的用戶名和密碼。
然後關閉連接。然後我比較文本框中的輸入值和值:
userd和字典中的passward。在成功直接到主要形式
這裏是我的代碼。請help`我如何循環throught詞典
string connectionstring =
"Data Source =localhost;Initial Catalog=HSM;" +
"User Id=sysad;Password=mypassword";
SqlConnection connection = new SqlConnection(connectionstring);
SqlCommand selectcmd = new SqlCommand("Select * from users");
SqlDataReader reader ;
Dictionary<string,string> logintest = new Dictionary<string,string>
try
{
connection.Open();
reader = selectcmd.ExecuteReader();
while (reader.Read())
{
Mainform main1 = new Mainform();
this.Hide();
main1.Show();
}
reader.Close();
`
你需要更好的標籤。任何問題的適當標籤都是您正在使用的語言,以及您正在使用的任何軟件/庫/框架。 –