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 = new SqlConnection("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.



Answer this question

SqlConnection - How to connect?

  • ETE

    First of all, catch the exception and print out errors from error collection. VS documentation has a sample on how to do that.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

     

    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.



  • Esrever

    Ilya Tumanov
    >>You do not need to install any additional components, just NETCF and SqlClient CABs.
    < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
    I've just copied System.Data.SqlClient.dll file to my device (in my program folder). It's enough
    Of cource I've installed NETCF before

  • LuckLess

    The Windows CE 4.2 platform is not supported Compact Framework 2.0.
    Compact Framework 2.0 is supported only on CE 5.0 (unless it's a Pocket PC 2003 or Windows Mobile device).

    You can see this thread on the newsgroup for more details.
    http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework/browse_frm/thread/9502958c2c4b135d/685a714246cdcb99 q=windows+CE+4.2+2.0&rnum=7#685a714246cdcb99

  • Ziran Lin - MSFT

    OK.
    But when i write same code in VS2003 and run it on WCE 4.2 with .NET Compact FrameWork 1.1 SP3 - same error occurs...
    Can you help me to connect


  • RluD

  • Tony T.

    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 Smile)

    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

  • Jim Sn

    No, it's not enough. You need to install SQL Client CAB.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />



  • AustinA6

    May be I have to install some additional components on my Windows CE (like adoce)
    Can anybody help me

  • bruceradtke

    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 < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    Also, if you’re using Visual Studio 2003, it would deploy SQL CAB automatically if you have reference to it added to your project.

     



  • Vaughn Friesen

    Can you help me to do it 

  • SqlConnection - How to connect?