Results 1 to 3 of 3

Thread: Problems with ADO.NET and Access Database

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    21

    Problems with ADO.NET and Access Database

    I have an ASP.NET intranet site that needs to read the usernames and passwords from an Access Data base. The code is

    <%@ Page Language="VB" %>
    <%@ Import Namespace="System.Data.OleDb" %>
    <%@ Import Namespace="System.Data" %>
    Sub login_avotus(Source As Object, E As EventArgs)
    dim rs,cn, dbpath, entity,rs2,temp_string
    dbpath = Server.MapPath("\Avotus_Data\PMD003.mdb")
    Dim myconn As New OleDBConnection("Data Source=dbpath;Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;")
    myconn.open
    Dim myAdapter as new OleDBDataAdapter("SELECT * FROM Attributes WHERE pCode='LGIN' AND Value = '" & User_Name.Text & "';", myConn)
    Dim myDataSet as DataSet = new DataSet()
    myAdapter.Fill(myDataSet,"Attributes")
    if myDataSet.Tables("Attributes").Rows.Count <=0 then
    lbl_status.Text="Username is invalid"
    User_Name.Text=""
    Password.Text=""
    exit sub
    end if
    entity = mydataset.Tables("Attributes").Rows(0).Item("pEntityID").toString()

    Dim myAdapter2 as new OleDBDataAdapter("SELECT * FROM Attributes WHERE (pEntityID=" & entity & " AND pCode='WPWD') AND Value='" & Password.Text & "';",myconn)
    Dim myDataSet2 as new DataSet()
    myAdapter2.Fill(myDataSet2,"Attributes")
    if myDataSet2.Tables("Attributes").Rows.Count <=0 then
    lbl_status.Text="Username and Password do not match"
    User_Name.Text=""
    Password.Text=""
    exit sub
    end if
    end sub

    When I supply a username and password in my webfrom I get the following error message when I try to open the database


    Line 15: dbpath = Server.MapPath("\Avotus_Data\PMD003.mdb")
    Line 16: Dim myconn As New OleDBConnection("Data Source=dbpath;Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;")
    Line 17: myconn.open
    Line 18: Dim myAdapter as new OleDBDataAdapter("SELECT * FROM Attributes WHERE pCode='LGIN' AND Value = '" & User_Name.Text & "';", myConn)
    Line 19: Dim myDataSet as DataSet = new DataSet()


    Source File: D:\Telecom Web Pages\Secure\avotus_login.aspx Line: 17

    Stack Trace:


    [OleDbException (0x80004005): Unspecified error]
    System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
    System.Data.OleDb.OleDbConnection.InitializeProvider() +57
    System.Data.OleDb.OleDbConnection.Open() +203
    ASP.avotus_login_aspx.login_avotus(Object Source, EventArgs E) in D:\Telecom Web Pages\Secure\avotus_login.aspx:17
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
    System.Web.UI.Page.ProcessRequestMain() +1277

    Any thoughts, I have given the Everyone group and ASP.NET account full control to the directory on the server. It works on my test machine(I have a copy of the Database file on my test machine) but, not on my server. Using ASP.NET v1.1.4322

    Thanks,

  2. #2
    Lively Member
    Join Date
    Jul 2003
    Posts
    93
    This sounds similar to a problem I'm having. Did you ever get it figured out?

    Corinne

  3. #3
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492

    Re: Problems with ADO.NET and Access Database

    Have you checked the web.config file? On the server it is setup much differently than it is locally.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width