Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   Using the Data Adapter Configuration Wizard (http://www.velocityreviews.com/forums/t760201-using-the-data-adapter-configuration-wizard.html)

Jim Brown 01-31-2004 04:43 AM

Using the Data Adapter Configuration Wizard
 
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#] 01-31-2004 09:18 AM

Re: Using the Data Adapter Configuration Wizard
 
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.AppSett ings["YourStringKey"];

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

"Jim Brown" <jb@applicationsplus.com> wrote in message
news:%23ElxqR75DHA.3308@TK2MSFTNGP11.phx.gbl...
> 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 01-31-2004 02:21 PM

Re: Using the Data Adapter Configuration Wizard
 
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" <jb@applicationsplus.com> wrote in message
news:%23ElxqR75DHA.3308@TK2MSFTNGP11.phx.gbl...
> 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 01-31-2004 04:50 PM

Re: Using the Data Adapter Configuration Wizard
 
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"
<max@ipattern.com> 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" <jb@applicationsplus.com> wrote in message
>news:%23ElxqR75DHA.3308@TK2MSFTNGP11.phx.gbl...
>> 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 01-31-2004 04:54 PM

Re: Using the Data Adapter Configuration Wizard
 
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" <max@ipattern.com> wrote in message
news:uxn2aRA6DHA.1020@tk2msftngp13.phx.gbl...
> 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" <jb@applicationsplus.com> wrote in message
> news:%23ElxqR75DHA.3308@TK2MSFTNGP11.phx.gbl...
> > 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
> >
> >

>
>





All times are GMT. The time now is 04:31 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.