Opening a SQLExpress database (Desktop) from PocketPC

  • Thread starter Thread starter Paul Aspinall
  • Start date Start date
P

Paul Aspinall

Hi
Can anyone point me in the right direction....
I'm trying to open a SQL Express 2005 DB, from my PocketPC, so that I can
write some code to synchronize the data.

Does anyone have any code to show this being done??

I'm using System.Data.SqlClient but from the PocketPC.

Any help appreciated.

Thanks

I'm trying:

SqlConnection Conn = new SqlConnection(@"Data
Source=\\desktopmachinename\SQLEXPRESS;AttachDbFilename=C:\dataname.mdf;Integrated
Security=True;User Instance=True");

SqlCommand CMD = new SqlCommand("nameofstoredprocedure", Conn);

CMD.CommandType = CommandType.StoredProcedure;

Conn.Open();

SqlDataReader dr = CMD.ExecuteReader();

dataGrid1.DataSource = dr;
 
Paul,

When you specify the AttachDBFileName in the Compact Framework
ADO.NET Provider, you must specify the Database keyword as well
(example - "Database=PaulsDB")

The User Instance connection string keyword is not used with the
CF ADO.NET provider.

A few things will get you in trouble with SQL Express. By default,
after install, it has ALL of it's connection protocols disabled. You have
to manually go in and set the surface area configuration to allow remote
connections and specify the type of connection (TCP, Named Pipes, etc)

Also make sure the Windows Guest account is enabled on your SQL Express
instance if you are trying to connect from the emulator.

You should also verify that your mobile device or emulator can resolve
the server name or it's IP address to verify you have a valid network path
to the server hosting SQL Express.

Finally, please do not post the same question to more than one newsgroup.

Either the Compact Framework or SQL CE newsgroup is the appropriate one
for this question.

--
Darren Shaffer
..NET Compact Framework MVP
Principal Architect
Connected Innovation
www.connectedinnovation.com
 
Back
Top