I'm working on an ADO.NET project. I'd like to declare a
Common Variable that can store the Connection String
values for a Database. I need this variable to be able to
initialise the database connection for all
OledbDataAdapters across all Form modules. Thanks!

Re: Common Connection by Miha

Miha
Fri Dec 05 03:49:21 CST 2003

Hi Lora,

You might put your connection string inside app.config file, example:
<configuration>
<appSettings>
<add key="connectionString" value="data source=myserver;initial
catalog=Apps;Integrated Security=SSPI;packet size=4096" />
</appSettings>
</configuration>

either bind it at design time (DynamicProperties) or access it using

string conn =
System.Configuration.ConfigurationSettings.AppSettings["YourConnection"];

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com


"Lora Connors" <lora_con@yahoo.com> wrote in message
news:06c601c3bb00$2f761dd0$a501280a@phx.gbl...
> I'm working on an ADO.NET project. I'd like to declare a
> Common Variable that can store the Connection String
> values for a Database. I need this variable to be able to
> initialise the database connection for all
> OledbDataAdapters across all Form modules. Thanks!



Common Connection by Bin

Bin
Fri Dec 05 13:10:19 CST 2003

It depends where you use it.
In Window form:
Place this variable or constant in a VB module.
Const ConnectString = "Data Source=..."
In Web form:
using Application("ConnectString") = "Data Source=..."
or put it in Web.config

Bin Song, MCP

>-----Original Message-----
>I'm working on an ADO.NET project. I'd like to declare a
>Common Variable that can store the Connection String
>values for a Database. I need this variable to be able
to
>initialise the database connection for all
>OledbDataAdapters across all Form modules. Thanks!
>.
>