错误:未定义类型sqlCeDataReader [英] error: type sqlCeDataReader is not defined

查看:136
本文介绍了错误:未定义类型sqlCeDataReader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai,我正在创建具有多级访问权限的登录页面.此登录页面已连接到数据库,并使用vb.net 2005和sql 2005,
我的数据库表中的列具有用户名,密码和部门.登录有效,但我尝试向其添加acces级别功能(管理员,计数器,商店访问级别,将您带到不同的页面),然后出现错误,键入sqlCeDataReader不是定义.请告知我如何解决此错误.这是代码使用1个登录按钮,2个文本框txtusername.Text和txtpassword.Text.以下是我的代码,我还突出显示了错误

 公共 登录
 Dim  table =  Me  .StaffTableAdapter1
私有  btnlogin_Click(> ByVal 发​​件人 As 系统.对象 ByVal  e  As  System.EventArgs) Handles  btnlogin.Click
 Dim  nama1  As  字符串
nama1 =  .txt用户名.Text
 Dim  table =  Me  .StaffTableAdapter1.user_pass( Me  .txtusername.Text, .txtpassword.Text)
 Dim 阅读器 As  SqlCeDataReader = objComm.ExecuteReader

如果阅读器.请阅读然后
如果阅读器( 0 )= " 管理员"  .Hide()
MsgBox(" & nama1,MsgBoxStyle.OkOnly)
databasestatus.Show()
Admin.Show()
'  ***************************** **************************************************** 
 ElseIf 阅读器( 0 )= " 商店"  .Hide()
MsgBox(" & nama1,MsgBoxStyle.OkOnly)
DatabaseStatus2.Show()
page.Show()
'  ***************************** ****************************************************** 
 ElseIf 阅读器( 0 )= "  Counter"  .Hide()

结束 如果

其他
MsgBox(" ,msgBoxStyle.Information)
txtusername.Text = " 
txtpassword.Text = " 
 .Close()
结束 如果 

解决方案

如果您使用.sdf文件作为数据库进行连接,即使用SqlCeConnection对象作为数据库连接,则不应出现此错误.如果不是,则应该使用SQLDataReader而不是SqlCeDataReader.

问题中提到的错误仅在您使用SqlCeDataReader但连接对象不是.sdf文件时才会发生.很难理解你的解释.或者,您可以在此处向我显示任何与我的问题有关或相关的链接.很抱歉要求>>>


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

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

解决方案

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.


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>>>


这篇关于错误:未定义类型sqlCeDataReader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆