我在编写asp
中的简单登录页面时遇到了问题default.aspx.vb 导入System.data Imports System.Data.OleDb
Partial Class _Default 继承System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\jensen\My Documents\login.mdb;Persist Security Info=True")
cn.Open()
Dim cmd As New OleDbCommand("Select user,pass,Type from login Where user= '" & tb_user.Text & "' AND pass = '" & tb_pass.Text & "' AND Type= '" & tb_type.Text & "'", cn)
Dim ***dr*** As New OleDbDataReader()
dr = cmd.ExecuteReader()
dr.Read()
If dr.Read = True Then
MsgBox("verification successfull")
Else
MsgBox("invalid username")
End If
cn.Close()
End Sub
结束课程 错误1:类型'System.Data.OleDb.OleDbDataReader'没有构造函数 当点击错误时 'Dim dr As New OleDbDataReader()' “dr”突出显示 帮我摆脱这个单一的错误 提前谢谢
答案 0 :(得分:0)
OleDbDataReader没有空构造函数。 尝试:
Dim dr As OleDbDataReader = cmd.ExecuteReader()
而不是:
Dim ***dr*** As New OleDbDataReader()
dr = cmd.ExecuteReader()