SqlConnection - How to connect?
Windows CE 4.2\.NET Compact Framework 2.0\VS2005 beta2\SQL Server 2000
I try to connect to remote database via SqlConnection class:
SqlConnection con =newSqlConnection("User ID=fabdulov;password=123654;server=serverdf;database=storage");
con.Open();
When I launch it on my PC - it works. But when I try to launch it on Windows CE - exception throws:
Error
symbol1.exe
SqlException
at SqlConnection.OnError()
at SqlInternalConnection.OnError()
at TdsParser.ThrowExceptionAndWarning()
at TdsParser.Connect()
at SqlInternalConnection.OpenAndLogin()
at SqlInternalConnection..ctor()
at SqlConnection.Open()
at Form1.button1_click()
etc...
I don't know what to do.. Please help.
[1000 byte] By [
Stimo] at [2007-12-16]
First of all, catch the exception and print out errors from error collection. VS documentation has a sample on how to do that.
Most likely you’re having problems with network connection or authentication.
Please make sure you have network connection to the server and you do not have firewall running which would prevent connection to the SQL Server.
Try using SQL Server IP instead of name. Also make sure you're using correct authentication and you're providing correct password/login in the connection string.
From your code I can see you’re using SQL authentication, make sure it’s enabled on your SQL Server.
You do not need to install any additional components, just NETCF and SqlClient CABs.
It's no different from installing NETCF CAB: copy SQL Client CAB to the device and click on it. Are you having difficulties with picking the right CAB?
Also, if you’re using Visual Studio 2003, it would deploy SQL CAB automatically if you have reference to it added to your project.
Hi
I am using VS 2005, latest .net Compact framework and sql ce for mobile. i am having trouble deploying to emulator as i get an error that says a dependency of sqlclientce was not found.
in my OS build i didn't find any sql CE components that i can add (something that comes with windows mobile apparently) so i am hoping that when i deploy the device all the components are copies as well (i made sure all the references have the copy to output directory checked
)
i am doing anything wrong still? this is taking me a long time to figure out, there isnt much documentation or maybe i am not looking at the right places?
Thanks
Souhail