Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataSource parameter in connection string yields "Keyword not supported"

Tags:

c#

sql-server

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?

like image 856
petko_stankoski Avatar asked Apr 30 '12 13:04

petko_stankoski


4 Answers

Data Source is two words.

like image 165
SLaks Avatar answered Oct 05 '22 18:10

SLaks


It should be in this form:

Data Source=
like image 33
mservidio Avatar answered Oct 05 '22 19:10

mservidio


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

like image 31
Christian.K Avatar answered Oct 05 '22 17:10

Christian.K


The usage is:

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
like image 36
Anil Mathew Avatar answered Oct 05 '22 18:10

Anil Mathew