1

I write an application for a Windows CE 5 device with VB.NET. It has installed .NET CF 3.5, SQL Client 2.0 and SQLServerCompact 3.5 Core.

I wrote the application and now I have to connect to the SQL Server 2012 Express on my computer. The device is connected via USB to the laptop and I use Visual Studio 2008 Professional to run the programm on the device.


Here is what I have written:

Imports System.Data.SqlClient
Dim conn As SqlConnection = Nothing
conn = New SqlConnection("Data Source=aigaiosPC\SQLEXPRESS;Initial Catalog=DataBaseName;Integrated Security=SSPI;User ID=aigaiosPC\Aigaios;Password=myPassword;)
conn.Open()

But I always get an exception when it tries to open:
The given computer with SQL Server couldn't be found: aigaiosPC\SQLEXPRESS

I found the connection string on connectionsstrings.com


How can I connect? Do I have to change the SQL Server Settings or the Norton Firewall?
ammerzon
  • 998
  • 1
  • 13
  • 30

2 Answers2

1

I did this and now i can connect:
1. On the Start menu, click Run. In the Run window type cmd, and then click OK.
2. In the command prompt window, type ipconfig and press enter. Note the IPv4 address.
3. Run SQL Server Configuration Manager.
4. Go to SQL Server Network Configuration > Protocols for SQLEXPRESS.
5. Make sure TCP/IP is enabled.
6. Right-click on TCP/IP and select Properties.
7. Verify that, under IP2, the IP Address is set to your IPv4 address.
8. Make sure that, under IPAll, TCP Dynamic Ports is blank. (mine was some 5-digit port number.)
9. Make sure that TCP Port is set to 1433 (mine was blank).

Source:
Enable Remote Connections
Troubleshoot SQL Database Engine

Community
  • 1
  • 1
ammerzon
  • 998
  • 1
  • 13
  • 30
0

dont know much about windows ce 5.

but the Integrated Security=SSPI is similar to Integrated Security=true. this means the current Windows account credentials are used for authentication

sounds to me like, your user "User ID=aigaiosPC\Aigaios;Password=myPassword" will be ignored. so you have to give the current Windows Account from your device the rights to access the database.

if still not working i would suggest you to go the following way, to identify where the problem is:

  1. try to ping the server from the client to check if they are in the same network. if ping fails --> fix general network issues

  2. Check if remote access for sqlserver2012 is enabled Enable Remote Connections

another possible problems could be:

  • firewall, port 1433, disable firewall for a moment
  • use ipadress\SQLEXPRESS instead of pcname\SQLEXPRESS

thats how i would debug it.

Community
  • 1
  • 1
Koryu
  • 1,371
  • 1
  • 11
  • 21