Groups | Blog | Home
all groups > dotnet ado.net > october 2007 >

dotnet ado.net : Connections String Questions


Mike TI
10/31/2007 4:53:29 AM
Oct 31, 2007

Hi all

Sorry for repeating my previous posting. I am new to VB Net.

Q1. Which provider should be preferred when defining a connection, Data
provider for SQL server or Data provider for OLEDB. I intend to use SQL
Express 2005.

Q2. I have a database on my local PC (SQL Server Express) and the same
database on a remote PC. I built a simple form with a grid. Now I want to
define the connection string in such a way that I am able to use any one of
the above two by changing the connection string definition on one place.

How do I go about this.

Thank you in advance.

Mike TI

Mary Chipman [MSFT]
10/31/2007 12:12:59 PM
As far as Q1 - always use SqlClient with a SQL Server or SQL Express
database.

You can supply connection strings in a variety of ways. I'd search the
Help on connection strings to see what best suits your application.

-Mary

On Wed, 31 Oct 2007 04:53:29 -0800, "Mike TI" <tanveer@creativepk.com>
[quoted text, click to view]
Andrew Faust
11/1/2007 2:06:00 PM
Q1) Use the SQL Server Provider.

Q2) Depends on your needs. There's really no "best" method for this. I
currently have apps that use App.Config, web sites that use Web.Config apps
that use a custom xml configuration files and a whole series of apps that
store the last 10 connection strings in the registry. It all depends on the
nature of your app.

A connection string is just a string. In terms of storing it and handing it
around your app it's really no different from any other string variable. That
being the case, you can store it literally anywhere else you might choose to
store a string.

--
Andrew Faust
http://www.andrewfaust.com


[quoted text, click to view]
Cor Ligthert[MVP]
11/3/2007 12:00:00 AM
In addition to Andrew,

....................and even set that in a combobox.

AddThis Social Bookmark Button