Web Matrix - Data Connection

Discussion in 'ASP.NET / ASP.NET Core' started by comblitz, Feb 7, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi. I've installed Web Matrix on my PC and have tabbed to the data tab. In there, I can create a new connection. I want to connect to the .mdb file I've created on the web server. The first question it asks is server:_____________

    What is the server supposed to be? Am I not supposed to be able to connect from my PC? Any help is appreciated.

    Thanks,

    Ron
     
  2. I am not an expert on Web Matrix, but from the little I have worked with it, I don't believe you can establish and data connection on the data tab to an Access (*.mdb) database. The wizard, when I looked at it, was for SQL or MSDE(built on the SQL engine) database. What I have done is set up a connection in my web.config file in the root of site on the server.

    <configuration>

    <appSettings>
    <add key="connAccessDB" value="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=e:\web\path to your access db.mdb;" />
    </appSettings>

    </configuration>

    Then, in your page you can call this connection:

    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OleDb" %>
    <script language="VB" runat="server">
    sub Page_Load(sender as Object, e as EventArgs)

    'Open a connection
    Dim objConnection as OleDbConnection = New OleDbConnection(ConfigurationSettings.AppSettings("connAccessDB"))
    objConnection.Open()

    etc. etc.
    end sub
    </script>


    This works for me. Let me know if you have problems.
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    The Database wizard comes with web matrix only works for SQL server. I don't believe it will work with MS Access.

    The best place on earth to learn how to use matrix is at

    http://www.asp.net/webmatrix/tour/getstarted/intro.aspx



    quote:Originally posted by comblitz

    Hi. I've installed Web Matrix on my PC and have tabbed to the data tab. In there, I can create a new connection. I want to connect to the .mdb file I've created on the web server. The first question it asks is server:_____________

    What is the server supposed to be? Am I not supposed to be able to connect from my PC? Any help is appreciated.

    Thanks,

    Ron
    </blockquote id="quote"></font id="quote">
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page