petko_stankoski
petko_stankoski

Reputation: 10723

DataSource parameter in connection string yields "Keyword not supported"

My code:

SqlConnection conn = new SqlConnection("DataSource=a;InitialCatalog=b;User ID=c;Password=d");

And I get error:

Keyword not supported: 'datasource'.

What to do?

Upvotes: 5

Views: 4482

Answers (5)

Brandon
Brandon

Reputation: 339

There is a space in between data and source "Data Source=a;"

Upvotes: 2

Anil Mathew
Anil Mathew

Reputation: 2696

The usage is:

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

Upvotes: 6

Christian.K
Christian.K

Reputation: 49320

The keyword is "Data Source", with a blank.

Upvotes: 2

mservidio
mservidio

Reputation: 13057

It should be in this form:

Data Source=

Upvotes: 2

SLaks
SLaks

Reputation: 888293

Data Source is two words.

Upvotes: 7

Related Questions