By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

Importing my database to my vb as an user account; (error)cannot find table 0.

P: 1
as i run my application this the output after the login. These are my codes from my vb.

Expand|Select|Wrap|Line Numbers
  1.  Public Function IsUserAuthorized() As Boolean
  2.         If oledbLogin.DS IsNot Nothing Then
  3.             oledbLogin.DS.Clear()
  4.         End If
  5.  
  6.         oledbLogin.RunLogin("SELECT Count(uname) As Usercount " & _
  7.                             "FROM tbluser " & _
  8.                             "WHERE uname = '" & TextBox1.Text & "' " & _
  9.                             "AND pword = '" & TextBox2.Text & "'")
  10.  
  11.         If oledbLogin.DS.Tables(0).Rows(0).Item("Usercount") = 1 Then
  12.             Return True
  13.         End If
  14.  
  15.         MsgBox("Invalid user credentials", MsgBoxStyle.Critical, "Login Failed")
  16.         Return False
  17.     End Function
  18.  
  19.     Public Sub GetUserInfo()
  20.         oledbLogin.RunLogin("SELECT roleacs" & _
  21.                         "FROM tbluser " & _
  22.                        "WHERE uname = '" & AuthUser & "' ")
  23.  
  24.         For Each i As Object In oledbLogin.DS.Tables(0).Rows
  25.             access_role = i.Item("roleacs")
  26.         Next
  27.     End Sub
  28.  
I have declared everything that should be declared. The public function success fully runs but when the next statement to be executed this error showed:

An unhandled exception of type 'System.IndexOutOfRangeException' occurred in System.Data.dll
Additional information: Cannot find table 0.

What should i do i'm just a college student and IT is not my course i dont now whats the sol'n i cannot do my project please help me.
Oct 11 '15 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.