Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ciao,
ho un& applicazione in .net su un dispositivo wince con un archivio .sdf a cui mi collego tranquillamente localmente con la stringa di connessione:
cnnDB.ConnectionString ="Data Source =" & pathapplicazione & "\db.sdf"

La mia esigenza è quella di connettermi all'archivio da un altro dispositivo.
ditemi ke è possibile!!!
avevo pensato ad una stringa del tipo:

cnnDB.ConnectionString = "Data Source=192.168.0.151\SQLEXPRESS;Initial Catalog=\Program files\db.sdf;Integrated Security=True;User Instance=True";

dove 192.168.0.151 è il dispotivo dove risiede il db. Ma restituisce un errore su Initial catalog

UPDATE Sandeep Mewara & CP: Google & Carlo gave this...
Hello,
I have a .NET application. on a WinCE device with a datadase file .sdf. I can connect locally, without problems, using the following connection string:
C#
cnnDB.ConnectionString = "Data Source =" & pathapplicazione & "\ db.sdf"

Now I need to connect to the database from another device.
Please tell me if it is possible.

I tried the following connection string:
C#
cnnDB.ConnectionString = "Data Source = 192.168.0.151 \ SQLEXPRESS, Initial Catalog = \ Program Files \ db.sdf; Integrated Security = True; User Instance = True";

where 192.168.0.151 is the IP address of the machine where the database resides. But returns an error on initial catalog.
Posted
Updated 6-May-10 8:02am
v5
Comments
William Winner 6-May-10 13:33pm    
again, English is the preferred language on here. You'll have better luck with getting answers if you translated it to English.

Since you are running your own server when you connect to SQL Server CE, you need to have read/write permission to the database file. In your remote call, it looks like you are trying to connect to a SQL Server database rather than a SQL Server CE database. When you connect to a SQL Server database, the server runs on the same machine as the database, which is different than how SQL Server CE works. If you want to use remote access, I highly recommend you consider SQL Server instead of SQL Server CE. Alternatively, you could provide a web service hosted on the same machine as the SQL Server CE database file, and that web service would pass queries and responses between the database and the caller.
 
Share this answer
 
Is the database really placed directly in the "Program Files" folder on the remote machine?

The "pathapplicazione" variable suggests to me that it is installed in a specific program folder and that you need to include that folder as well, e.g.

cnnDB.ConnectionString = "Data Source = 192.168.0.151\SQLEXPRESS, Initial Catalog =\Program Files\myApplicationName\db.sdf; Integrated Security=True; User Instance=True";

You might also try using the absolute path to see if that works, e.g. C:\Program Files\myApplicationName\db.sdf (or whatever it is...)

Good luck,
Johnny J.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900