Using the Data Adapter Configuration Wizard

Discussion in 'ASP .Net Datagrid Control' started by Jim Brown, Jan 31, 2004.

  1. Jim Brown

    Jim Brown Guest

    I have been trying to design a Web Form using VB.Net 2002 that uses a
    DataGrid to display a MS Access database.



    When using the Data Adapter Configuration Wizard on my local server I
    successfully make a "New Connection" after pointing it to the Access MDB
    file on my local file system. But when I try to duplicate this on my live
    web server I can't figure out what to put in for the path to my database.



    Can I use the wizard or do I have to build the OleDbConnection's DataSource
    string manually as my web page loads?



    Live site is hosted at Microsoft bCentral
     
    Jim Brown, Jan 31, 2004
    #1
    1. Advertising

  2. Hi Jim,

    You should set OleDbConnection.ConnectionString properly - you might store
    the connection string in web.config file and read it:
    web.config:
    <?xml version="1.0" encoding="windows-1250"?>
    <configuration>
    ...
    <appSettings>
    ...
    <add key="YourStringKey" value="connection string"/>
    ....
    < /appSettings>
    ...
    </configuration>

    Code:
    oleDbConnection.ConnectionString =
    System.Configuration.ConfigurationSettings.AppSettings["YourStringKey"];

    --
    Miha Markic [MVP C#] - RightHand .NET consulting & development
    miha at rthand com
    www.rthand.com

    "Jim Brown" <> wrote in message
    news:%...
    > I have been trying to design a Web Form using VB.Net 2002 that uses a
    > DataGrid to display a MS Access database.
    >
    >
    >
    > When using the Data Adapter Configuration Wizard on my local server I
    > successfully make a "New Connection" after pointing it to the Access MDB
    > file on my local file system. But when I try to duplicate this on my live
    > web server I can't figure out what to put in for the path to my database.
    >
    >
    >
    > Can I use the wizard or do I have to build the OleDbConnection's

    DataSource
    > string manually as my web page loads?
    >
    >
    >
    > Live site is hosted at Microsoft bCentral
    >
    >
     
    Miha Markic [MVP C#], Jan 31, 2004
    #2
    1. Advertising

  3. Jim,
    If you use Data Adapeter Wizard than Connection object is created for you
    inside of the Designer. If you click on the properties of the object you
    will see DynamicProperty, simply select ConnectionString. It will generate
    entry for your web.config or app.config file that you can modify later. With
    this approach you do not have to write any code.

    Maxim

    [www.ipattern.com do you?]
    "Jim Brown" <> wrote in message
    news:%...
    > I have been trying to design a Web Form using VB.Net 2002 that uses a
    > DataGrid to display a MS Access database.
    >
    >
    >
    > When using the Data Adapter Configuration Wizard on my local server I
    > successfully make a "New Connection" after pointing it to the Access MDB
    > file on my local file system. But when I try to duplicate this on my live
    > web server I can't figure out what to put in for the path to my database.
    >
    >
    >
    > Can I use the wizard or do I have to build the OleDbConnection's

    DataSource
    > string manually as my web page loads?
    >
    >
    >
    > Live site is hosted at Microsoft bCentral
    >
    >
     
    Maxim V. Karpov, Jan 31, 2004
    #3
  4. Jim Brown

    Jim Brown Guest

    OK, now I get it. I can point towards a local hard drive copy of my
    database to get through the wizard. Then I set the DynamicProperty as
    you say so a key gets added to my web.config in the <appSettings>.

    I was able to use the Server.Mathpath function to determine the actual
    path to my live web server. I hard coded that in the web.config's copy
    of the key noted above and all seems to work.

    I wound up with this (except that 111.222.333.444 is not the actual IP
    address):
    \\111.222.333.444\files6\191\applicationsplus.com\web\dotnet\vbtest\db\webdata.mdb

    Everything after the \applicationsplus.com makes sense to me as that's
    the folder paths in my site. I'm sure that the pieces before could
    change if my web host moves my site to another of their servers. So my
    next question: is there a better way of coding this into the
    web.config file?


    On Sat, 31 Jan 2004 09:21:04 -0500, "Maxim V. Karpov"
    <> wrote:

    >Jim,
    > If you use Data Adapeter Wizard than Connection object is created for you
    >inside of the Designer. If you click on the properties of the object you
    >will see DynamicProperty, simply select ConnectionString. It will generate
    >entry for your web.config or app.config file that you can modify later. With
    >this approach you do not have to write any code.
    >
    >Maxim
    >
    >[www.ipattern.com do you?]
    >"Jim Brown" <> wrote in message
    >news:%...
    >> I have been trying to design a Web Form using VB.Net 2002 that uses a
    >> DataGrid to display a MS Access database.
    >>
    >>
    >>
    >> When using the Data Adapter Configuration Wizard on my local server I
    >> successfully make a "New Connection" after pointing it to the Access MDB
    >> file on my local file system. But when I try to duplicate this on my live
    >> web server I can't figure out what to put in for the path to my database.
    >>
    >>
    >>
    >> Can I use the wizard or do I have to build the OleDbConnection's

    >DataSource
    >> string manually as my web page loads?
    >>
    >>
    >>
    >> Live site is hosted at Microsoft bCentral
    >>
    >>

    >
     
    Jim Brown, Jan 31, 2004
    #4
  5. Jim Brown

    Jim Brown Guest

    OK, now I get it. I can point towards a local hard drive copy of my database
    to get through the wizard. Then I set the DynamicProperty as you say so a
    key gets added to my web.config in the <appSettings>.

    I was able to use the Server.Mathpath function to determine the actual path
    to my live web server. I hard coded that in the web.config's copy of the key
    noted above and all seems to work.

    I wound up with this (except that 111.222.333.444 is not the actual IP
    address):
    \\111.222.333.444\files6\191\applicationsplus.com\web\dotnet\vbtest\db\webda
    ta.mdb

    Everything after the \applicationsplus.com makes sense to me as that's the
    folder paths in my site. I'm sure that the pieces before could change if my
    web host moves my site to another of their servers. So my next question: is
    there a better way of coding this into the web.config file?



    "Maxim V. Karpov" <> wrote in message
    news:...
    > Jim,
    > If you use Data Adapeter Wizard than Connection object is created for you
    > inside of the Designer. If you click on the properties of the object you
    > will see DynamicProperty, simply select ConnectionString. It will generate
    > entry for your web.config or app.config file that you can modify later.

    With
    > this approach you do not have to write any code.
    >
    > Maxim
    >
    > [www.ipattern.com do you?]
    > "Jim Brown" <> wrote in message
    > news:%...
    > > I have been trying to design a Web Form using VB.Net 2002 that uses a
    > > DataGrid to display a MS Access database.
    > >
    > >
    > >
    > > When using the Data Adapter Configuration Wizard on my local server I
    > > successfully make a "New Connection" after pointing it to the Access

    MDB
    > > file on my local file system. But when I try to duplicate this on my

    live
    > > web server I can't figure out what to put in for the path to my

    database.
    > >
    > >
    > >
    > > Can I use the wizard or do I have to build the OleDbConnection's

    > DataSource
    > > string manually as my web page loads?
    > >
    > >
    > >
    > > Live site is hosted at Microsoft bCentral
    > >
    > >

    >
    >
     
    Jim Brown, Jan 31, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian P. Hammer
    Replies:
    1
    Views:
    422
    RadekP
    Aug 4, 2003
  2. Randy Smith
    Replies:
    0
    Views:
    433
    Randy Smith
    Apr 28, 2005
  3. monika
    Replies:
    0
    Views:
    434
    monika
    Jun 24, 2005
  4. ocean
    Replies:
    0
    Views:
    383
    ocean
    Mar 13, 2006
  5. ocean
    Replies:
    1
    Views:
    535
    =?Utf-8?B?RFdT?=
    Mar 15, 2006
Loading...

Share This Page