2009-07-22 6 views
1

に私はASPでエラーログインページはasp.netのOLEDB

default.aspx.vb 輸入System.data 輸入のSystem.Data.OleDb

部分クラスを簡単なログインページをコンパイルするには、問題を抱えて_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' にはコンストラクタがありません。エラーが クリックする
「新OleDbDataReaderクラスとして暗いDRを()」 「DR」は事前に おかげで、この単一errrorのうち 助け、私は

答えて

0

OleDbDataReaderクラスが空のコンストラクタを持っていないハイライト表示されます。 試してみてください。

Dim dr As OleDbDataReader = cmd.ExecuteReader() 

の代わり:

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