Connect to anothe database

H

Husam

Hi EveryBody:

How can I connect to another database instaed of the default database
aspnetdb in the local SQL Server in the App_Data folder that exist in my web
site application ?

My database that I want to connect is in my local Machine and its name=Husam.

Any Help or redirection will be completely appreciated

regard's

Husam
 
G

Guest

Hi EveryBody:

How can I connect to another database instaed of the default database
aspnetdb in the local SQL Server in the App_Data folder that exist in my web
site application ?

My database that I want to connect is in my local Machine and its name=Husam.

Any Help or redirection will be completely appreciated

regard's

Husam

You should connect a database using connection string.

Example of connection string for SQL Server 2000

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated
Security=SSPI;

More examples you can find here
http://www.connectionstrings.com/?carrier=sqlserver

string cs = "Data Source=myServerAddress;Initial
Catalog=myDataBase;Integrated Security=SSPI;"
using (SqlConnection cn = new SqlConnection(cs))
{
SqlCommand cmd = new SqlCommand();
.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top