4

I'm guessing you get hundreds of these questions, but here goes:

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

I am a complete newbie to SQL Server and mobile development, and am still a little green in C# (yeah I know, jumped in the deep end here, eh? :D)

So far I have:

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

The app deploys quite happily to the 6100, but the last line bugs out with a vague "SQL Exception" error.

I have tried changing the Data Source to include instance names, slashes and dots before it etc etc (even though server is just using the default instance), to no avail.

I can connect to the database in Management Studio with no problems.

So, is the connection string at fault, or is it something I haven't done correctly in SQL Server?

Thanks in advance.

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

3
  • 1
    Are you sure the instance of sql server has the default name ? Commented Jan 27, 2011 at 17:40
  • also, are you sure you can use a trusted connection to this remote DB? Might have to set user / password Commented Jan 27, 2011 at 17:41
  • how would I be able to check these things? I've tried setting a username and password and specifying them in the connection string, no luck Commented Jan 27, 2011 at 17:52

1 Answer 1

3

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

Another thing to try, besides using a UID/PWD to connect is to refer to the server by IP. It's possible that DNS resolution is not taking place properly on your device. Hmm, that is a whole nother issue. Is your device on the same network as the SQL Server?

And for future reference, commit this handy URL to memory: http://connectionstrings.com

EDIT

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

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

if not named SQL Server instance:

@"Data Source=192.168.0.56;DataBase=EMS_Main;User Id=joe;Password=pwd;";  
Sign up to request clarification or add additional context in comments.

8 Comments

At the mo it's cradled and connected by USB, but also the dev machine and the device are also both connected to the same wireless router. Have just tried using a UID & PW, still the same sqlexception error.
What is the error message? And make sure you can ping the server from your device. The USB bridge can be weird. Have you tried the IP address in your connection string?
gah just tried to ping from the device, no luck. guess this is a network problem rather than my dodgy programming then!
OK, I can now ping (McAfee was in the way before), but still no joy connecting to SQLS
Let's see an updated connection string with IP address instead of machine name AND the SQL Server instance name, if it is a named instance. See edit in answer.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.