Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Problem in storing connection string in Web Config file


Message #1 by "Shekhar Kulkarni" <shekhar@a...> on Fri, 10 Jan 2003 06:14:32
Hi All,
I have set the connection string in web config file as follows:

<appSettings>
<add key="ConnectionString" value="Provider=Microsoft.Jet.Oledb.4.0;Data 
Source=\html\db\currentstd.mdb" />
</appSettings>

And i am reteriving it in aspx page as usual like:

Dim strConnect As String
        strConnect = ConfigurationSettings.AppSettings("ConnectionString")

But it is showing diffrent path than actually database path i.e. 
c:\html\db\currentstd.mdb.
Whether it is not possible to set the databse path in a matter i have set.

Shekhar
Message #2 by "RAJESH P. (BEACONSOFT)" <RAJESHP@b...> on Fri, 10 Jan 2003 11:55:48 +0530
It's not possible.Give only the database name alone.

<add key=3D"BooksOleDb"
			value=3D"Provider=3DSQLOLEDB.1;Password=3Dasp;Persist Security 
Info=3DTrue;User ID=3Draj;Initial Catalog=3DBooks;Data 
Source=3DRAAJESHP" />

If you have any doubt about connection string open your notepad and save 
the empty file as .udl extension.
Right click the file, select the property and select provider tab and 
select
the database drive and click next.

Don't forget to click Allow saving password checkbox.

Then drag the file to notepad this will give you the exact connection 
string required.

P.Raajesh





-----Original Message-----
From: Shekhar Kulkarni [mailto:shekhar@a...]
Sent: Friday, January 10, 2003 11:45 AM
To: aspx_beginners
Subject: [aspx_beginners] Problem in storing connection string in Web
Config file


Hi All,
I have set the connection string in web config file as follows:

<appSettings>
<add key=3D"ConnectionString" 
value=3D"Provider=3DMicrosoft.Jet.Oledb.4.0;Data
Source=3D\html\db\currentstd.mdb" />
</appSettings>

And i am reteriving it in aspx page as usual like:

Dim strConnect As String
        strConnect =3D 
ConfigurationSettings.AppSettings("ConnectionString")

But it is showing diffrent path than actually database path i.e.
c:\html\db\currentstd.mdb.
Whether it is not possible to set the databse path in a matter i have 
set.

Shekhar

  Return to Index