tags:

views:

55

answers:

1

i been having problem in compiling a simple login page in asp

default.aspx.vb Imports System.data Imports System.Data.OleDb

Partial Class _Default Inherits 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

End Class error 1:type 'System.Data.OleDb.OleDbDataReader' has no constructors.
when the error is clicked the 'Dim dr As New OleDbDataReader()' the "dr" is highlighted help me out of this single errror thanks in advance

A: 

OleDbDataReader doesn't have an empty constructor. Try:

Dim dr As OleDbDataReader = cmd.ExecuteReader()

instead of:

Dim ***dr*** As New OleDbDataReader()
    dr = cmd.ExecuteReader()
crossy