Click here to Skip to main content
15,906,628 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai ,i am creating login page with multilevel access .This login page is connected to database and using vb.net 2005 and sql 2005,
the column in table my database has username , password and department .The login works but i tried adding an acces level feature to it (Admin,Counter, Store access level , takes you to diferent pages) and then i got errors type sqlCeDataReader is not defined. Please advice my how to solve this error.This is the code use 1 login button , 2 text boxes txtusername.Text and txtpassword.Text . Below is my code and i also highlight the error

VB
Public Class Login
Dim table = Me.StaffTableAdapter1
Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click
Dim nama1 As String
nama1 = Me.txtusername.Text
Dim table = Me.StaffTableAdapter1.user_pass(Me.txtusername.Text, Me.txtpassword.Text)
Dim reader As SqlCeDataReader = objComm.ExecuteReader

If reader.Read Then
If reader(0) = "Admin" Then
Me.Hide()
MsgBox("You Are Login " & nama1, MsgBoxStyle.OkOnly)
databasestatus.Show()
Admin.Show()
'*************************************************************************
ElseIf reader(0) = "Store" Then
Me.Hide()
MsgBox("You Are Login " & nama1, MsgBoxStyle.OkOnly)
DatabaseStatus2.Show()
page.Show()
'**************************************************************************
ElseIf reader(0) = "Counter" Then
Counter.Show()
Me.Hide()

End If

Else
MsgBox("Incorrect Username or Password!", msgBoxStyle.Information)
txtusername.Text = ""
txtpassword.Text = ""
Me.Close()
End If
Posted
Updated 14-Sep-11 15:16pm
v2

If you are using an .sdf file as the database to connect i.e using a SqlCeConnection object as DB conection then you should not have this error. If not you should be using SQLDataReader not SqlCeDataReader.

The error mentioned in the question can only happen if you are using SqlCeDataReader but the connection object is not a .sdf file.
 
Share this answer
 
Hai prdshukla, would you show same example or code please, it very hard to understand your explaination. Or maybe you can show me any link which refer or related about my probleam here. Sorry for request to much>>>
 
Share this answer
 
Comments
Pradeep Shukla 15-Sep-11 0:53am    
Do not use SqlCeDataReader, instead use SqlDataReader if your connection object is not created using an .sdf file. That would solve your issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900