SQL Server Connection String

I guess you get hundreds of such questions, but here goes:

So, I'm trying to get a Honeywell Dolphin 6100 mobile device (CE5.0, .NET Compact Framework) to talk to the SQL Server Express 2008 database installed on the machine I'm developing on.

I'm a complete newbie in SQL Server and mobile development, and I'm still a bit green in C # (yes, I know, jumped into the deep end here, eh ?: D)

So far, I:

string sConnection = @"Data Source=JEZ-LAPTOP;DataBase=EMS_Main;Integrated Security=SSPI;"; SqlConnection sqc = new SqlConnection(sConnection); sqc.Open(); 

The application deploys quite happily with 6100, but the last line of errors is with an unspecified SQL Exception error.

I tried changing the data source to include instance names, slashes, and front points, etc. etc. (even if the server just uses the default instance), but to no avail.

I can easily connect to the database in Management Studio.

So, is the connection string erroneous, or is it something I did not do correctly in SQL Server?

Thanks in advance.

This site is awesome btw, some very knowledgeable guys here.

+4
source share
1 answer

CE 5.0 does not support integrated security. I believe that the first version for support was mobile 6.1. In any case, you cannot use SSPI with your configuration. You will need to create a SQL Server user and use it as your credentials.

Another thing to try, besides using UID / PWD to connect, is to refer to the server by IP. It is possible that DNS resolution is not being performed properly on your device. Hmm, this is the whole problem. Is your device on the same network as SQL Server?

And for future reference, make this convenient URL in memory: http://connectionstrings.com

EDIT

Let's see something like ... if an instance of Named SQL Server:

 @"Data Source=192.168.0.56\SERVER_NAME;DataBase=EMS_Main;User Id=joe;Password=pwd;"; 

if no instance of SQL Server is specified:

 @"Data Source=192.168.0.56;DataBase=EMS_Main;User Id=joe;Password=pwd;"; 
+3
source

Source: https://habr.com/ru/post/1337360/


All Articles