draginvoke5 Posted December 28, 2012 Author Share Posted December 28, 2012 So I was doing a little coding and It's 5 AM where I am and I haven't gotten any sleep since 2 days ago so I'm pretty sure the answer is right in front of me but I'm to tired and I can't find it…. So here is the code:```Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim connString As String = "Provider=Microsoft.ACE.OLEDB.12.0;DataSource=C:\Users\Tammie\AppData\Local\Microsoft\VisualStudio\11.0\Databases\Users.accdb" Dim myConnection As OleDbConnection = New OleDbConnection Dim da As OleDbDataAdapter Dim strSql As String Dim ds As DataSet Dim firstName As String strSql = "SELECT tblUsers.firstName FROM tblUsers" strSql = strSql & "WHERE (tblUsers.Username = '" & (Me.TextBox1.Text) & "' " strSql = strSql & "And tblUsers.Password = '" & (Me.TextBox2.Text) & "');" myConnection.ConnectionString = connString da = New OleDbDataAdapter(strSql, myConnection) ds = New DataSet da.Fill(ds, "Users") myConnection.Close() For Each rowTest In ds.Tables(0).Rows firstName = rowTest("FirstName").ToString Next If firstName <> "" Then MessageBox.Show("Welcome " & firstName & "!") Else MessageBox.Show("Please check user name and password.") End IfEnd Sub```The error is on this line;```da.Fill(ds, "Users")```and it says this:OleDbException was unhandled.So I'm pretty sure I'll get a response soon and that will be that. So thanks in advance! Link to comment Share on other sites More sharing options...
Ryo Posted December 28, 2012 Share Posted December 28, 2012 Check you spelled the name of your columns correctly. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now