How to acess microsoft access remotely using asp.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • khaledjawaher
    New Member
    • May 2010
    • 1

    How to acess microsoft access remotely using asp.net

    I am writing an application on my PC to insert record on a Microsoft Access database on another pc that has static ip address remotely. I can ping the remote address of the PC that I want to access without problems. The access database is in the folder c:\inetpub\wwwr oot\db.mdb.
    I have the code below but when I run it I am getting the following error:

    error on ther server the object model couldnÂșt be found
    OleDbException 0x800a2011

    Code:
    <%@ LANGUAGE = VB Debug="true"  %> 
    <%@ Import Namespace="System.Data.OleDb" %>   
    <%@ Import Namespace="System.Net.Mail" %> 
    <%@ Import Namespace= "System.Web.UI.WebControls.Menu" %>
    <%@ Import Namespace="System.Data" %>      
    <script Runat="Server" language="VB">
    public sub button_click(s as object,e as EventArgs)
                 dim ssql as string  
                 dim strconn,objconn,rs,dbcomm 
                 Dim ds As New DataSet
                 Dim da As OleDbDataAdapter = New OleDbDataAdapter
                 objconn=new oledbconnection("Provider=MS Remote; Remote Server=http://196.45.161.123; Remote Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\db.mdb;Persist Security Info=False")  
                 objconn.open ()
                 dbcomm=New Oledbcommand("employee",objconn)
                 dbcomm.commandtext="insert into employee values ('mostafa',7,'tanzania')" 
                 dbcomm.Connection = objconn   
                 dbcomm.ExecuteNonQuery()
                 objconn.close ()
     
    end sub
    </script>
    <html>
    <Head>
    </HEAD>
    
    <BODY BGCOLOR="White" TOPMARGIN="10" LEFTMARGIN="10">
    <form Runat="Server">
        <asp:textbox id="t1" Runat="Server" text="type"  />
        <asp:button id="b1" Runat="Server" onclick="button_click" text="clickme" />
        
    </form>
    </BODY>
    </HTML>
    Last edited by Niheel; May 28 '10, 10:03 AM. Reason: punctuation, grammar, codetags
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Try moving the Access Database into the web application.
    (Or does this page exist in the same folder??)

    You could try moving the Access Database into your AppData folder...

    Comment

    Working...