Hi
I have same requirement to connect from PPC to SQL Server 2005. I have installed VS.NET 2005, SQL Server 2005 Deverloper Edittion, Active sync 4.2. When I run application on emulator, I am getting sqlexception saying that SqlServer Doesn't exist or authentication failed. Error occuring while opening connection to sqlserver. Do I need to install any other s/ws. I went through help in MSDN forum (http://netcf2.blogspot.com/2005/12/accessing-sql-server-express-from.html), but didn't work. I verified port etc, those are okay. I haven't install any emulator, working on default emulator comes with VS.Net 2005. I used the following code. I have doubt like, application runs on emulator, how the connection established to sqlserver. Do I need to configure ActiveSync to root connection. VS.net 2005 tool-> option -> device emulator manager was not appeared, what could be the probelm. Please suggest, thanks in advance.
System.Data.SqlClient.
SqlConnection con = new System.Data.SqlClient.SqlConnection("Server=10.22.24.82,1433;Initial Catalog=Samples;User ID=sa;Password=Password;Integrated Security=SSPI;");con.Open();
System.Data.SqlClient.
SqlCommand cmd = new System.Data.SqlClient.SqlCommand("select * from sample", con);System.Data.SqlClient.
SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(cmd); DataTable dt = new DataTable();da.Fill(dt);
dataGrid1.DataSource = dt;

SqlException while trying to establish(open) connection to SQLServer 2005 from Pocket PC2003
laiseng
mamrg
Surjeet Singh
follow the instructions provided at http://netcf2.blogspot.com/2005/12/accessing-sql-server-express-from.html.
FSOR
Hi Anr
thanks for reply, but your code works for mobile database (.sdf). I wanted to connect SQL Server 2005, not mobile database. plz refer to the link in previous post.
thanks,
jmcole76
You need to choose the data source as "Microsoft sql server mobile edition".
In design time, click the Data -- Add new data source
Select Database as Data source
Select New connection, Select "sql server mobile edition" as provider
Choose 'My Computer', click the browse button and select the Northwind.sdf
(if you want to use ActiveSync, make sure the device is connected or emulator is cradled; And copy the Nothwind.sdf to some directory in your device)
Use this connection
<Snippet>
SqlCeConnection con = new SqlCeConnection("Data Source=\\program files\\DeviceApplication1\\Northwind.sdf");
con.Open();
SqlCeCommand cmd = new SqlCeCommand("select * from customers", con); SqlCeDataAdapter da = new SqlCeDataAdapter(cmd); DataTable dt = new DataTable();da.Fill(dt);
</snippet>