我找不到基本错误,需要一些帮助才能找到它。在我的表单加载时出现错误,我试图在我的文本框中显示来自我的数据库的信息。
我错过了什么?
错误是对象实例未设置为引用
我知道密码不应存储在表格中,我只是在玩耍
clsDataSource.mycon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\carole\Desktop\CollegeLasalleFall2016\ProgrammationEvenementielle\RealEstate\RealEstate.mdb");
clsDataSource.mycon.Open();
DataSet myset = new DataSet();
int current = 0;
OleDbCommand mycmd = new OleDbCommand("SELECT UserID, email, pwd, FirstName, LastName, BoolAgent, BoolAdmin FROM Users WHERE (BoolAgent = 1)", clsDataSource.mycon);
OleDbDataAdapter myadapt = new OleDbDataAdapter(mycmd);
myadapt.Fill(myset, "AllAgents");
DataTable tbUser = myset.Tables["Users"];
//fill the textbox
txtFirstName.Text = tbUser.Rows[current]["FirstName"].ToString();