0
我得到這個錯誤運行debbugger看到錯誤後:無法投類型的對象System.Data.DataSet中
"Unable to cast object of type 'System.Data.DataSet' to type 'NLHosp.DataSet"
‘NLHosp’是我的數據庫的名稱。
這裏是代碼:
private void btnLogin_Click(object sender, System.EventArgs e)
{
string strUser;
string strPass;
string sMsg = "";
strUser = txtUserID.Text ;
strPass = txtPassword.Text ;
DataSet o_Find = new DataSet();
Users oUsers = new Users();
try
{
o_Find = (DataSet)oUsers.FindData(strUser,strPass);
sMsg = "Welcome " + o_Find.Tables ["Login"].Rows[0]["UserName"].ToString();
switch (strUser)
{
case "Admissions":
frmAdmissions admitForm = new frmAdmissions();
admitForm.Visible = true;
admitForm.Activate();
break;
case "Admin":
case "Nurse":
case "Doctor":
frmMenu menuForm = new frmMenu();
menuForm.oCurrent.UserName = strUser;
menuForm.Visible = true;
menuForm.Activate();
menuForm.SelectUser();
break;
}
}
那麼你有什麼建議我做?kmatyaszek – user2121793 2013-03-02 15:43:20