The DataSource parameter in the connection string gives "Keyword not supported"

My code is:

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

And I get the error message:

Keyword not supported: 'datasource'.

What to do?

+5
source share
5 answers

Data Source - two words.

+7
source

Using:

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

It should be in this form:

Data Source=
+2
source

The keyword is "Data Source" with a space.

+2
source

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

+2
source

All Articles