Tuesday, March 27, 2012

Connecting to sql server 2005

I want to connect to database using sql server 2005 through Visual web developer 2005 express edition . what will be the connection string for this....

keywords under * * are for your own variable.

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ *datafile name *.mdf;Integrated Security=True;User Instance=True"

if it is a database in a local drive

and if you are using a web server ,

connectionString="data source=*ip address * ;user id=userid;password=pass"

|||

The following link might help you..

http://www.connectionstrings.com/?carrier=sqlserver2005

|||

sagar Khatri wrote:

keywords under * * are for your own variable.

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ *datafile name *.mdf;Integrated Security=True;User Instance=True"

if it is a database in a local drive

In fact that is not the right explanation. The above mentioned syntax is used when you use the SQL Server 2005 Express feature of user instances. The above mentioned sample assumes that yxou have a local SQL Server Express instance (configured with the instance name of SQLEXPRESS). User instances are used to temporary attach datafile to SQL Server instances.

sagar Khatri wrote:

and if you are using a web server ,

connectionString="data source=*ip address * ;user id=userid;password=pass"

This has nothing to do with a web server. The above mentioned syntax is used when you have a SQL Server attached database. No matter which middle tier (either an application you wrote or a web server is connecting to the database server)=, you are able to have multiple conenctions from multiple applications to this database, other then the user instance where only one application can create a user instance and have access to the database at a time.

Jens K. Suessmeyer

http://www.sqlserver2005.de

sqlsql

No comments:

Post a Comment