SQL Express & SQLclient problem in VB2005

Hi guys, this is my first post here, im a VB Win developer with some experience, and now id like to try Smartphone programming, but i reaally need some help, heres my case:

Im using VB 2005 and i have installed SQL Server 2005 Express.

I create a new project and add a reference to System.Data.Sqlclient, located in:

C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Client\v1.0

Then i procceed to import the namespaces:

Imports System
Imports System.Data
Imports System.Data.SqlClient

Since i just wanted to test if the connection works just like it does in VB Windows Applications, i added a Textbox (named Textbox1) and added the following code in the KeyPress event:

Dim strconn As String = "Data Source=XZIBIT;Initial Catalog=cels;Persist Security Info=True;User ID=Celular;Password=celular"
Dim conn As New SqlConnection(strconn)

XZIBIT its an SQL Express 2005 instance in the localhost.

I executed the program into the Smartphone 2003 SE Emulator, everything went ok, but when i press a key inside the textbox (wich obviously triggers the KeyPress event), then i get an exception saying something like:

The Type System.Data.Sqlclient.SqlConnection could not be loaded in the Assembly System.Data.SqlClient, Version=1.0.5000.0, Culture=Neutral, PublicKeyToken=969DB8053D3322AC.

(I
m sorry if the Error message its a little different, but i have installed the spanish version of V.S. 2005, so i cant really know the exact error description in english...)

So, anyone has any ideas about how to make this work , im i referencing the right System.Data.SqlClient.dll , i dont know what else to try...

Thanks in advance!

Emmanuel Pastor.





Answer this question

SQL Express & SQLclient problem in VB2005

  • Rhubarb

    Hi guys, this is my first post here, im a VB Win developer with some experience, and now id like to try Smartphone programming, but i reaally need some help, heres my case:

    Im using VB 2005 and i have installed SQL Server 2005 Express.

    I create a new project and add a reference to System.Data.Sqlclient, located in:

    C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Client\v1.0

    Then i procceed to import the namespaces:

    Imports System
    Imports System.Data
    Imports System.Data.SqlClient

    Since i just wanted to test if the connection works just like it does in VB Windows Applications, i added a Textbox (named Textbox1) and added the following code in the KeyPress event:

    Dim strconn As String = "Data Source=XZIBIT;Initial Catalog=cels;Persist Security Info=True;User ID=Celular;Password=celular"
    Dim conn As New SqlConnection(strconn)

    XZIBIT its an SQL Express 2005 instance in the localhost.

    I executed the program into the Smartphone 2003 SE Emulator, everything went ok, but when i press a key inside the textbox (wich obviously triggers the KeyPress event), then i get an exception saying something like:

    The Type System.Data.Sqlclient.SqlConnection could not be loaded in the Assembly System.Data.SqlClient, Version=1.0.5000.0, Culture=Neutral, PublicKeyToken=969DB8053D3322AC.

    (I
    m sorry if the Error message its a little different, but i have installed the spanish version of V.S. 2005, so i cant really know the exact error description in english...)

    So, anyone has any ideas about how to make this work , im i referencing the right System.Data.SqlClient.dll , i dont know what else to try...

    Thanks in advance!

    Emmanuel Pastor.

  • meravsha

    Firstly, what do you want to do Access the database on the PC or access the database on the mobile device

    if you are wanting to access the database on the mobile device, you need to install SQL Mobile edition, but I believe this can be done on PPC's and devices running WM5, not Smartphone 2003/SE.

    Please clarify this so we can assist you further.

    Thanks!



  • NikiB

    You're referencing correct DLL, but it can't work since SP 2003 does not support installation of SQL Client or SQL Server CE.

    That would work on PPC 03/WM 5.0 PPC with NETCF V1 and on any device which supports NETCF V2.

    You would need to configure your server correctly, fix "localhost" issue and provide correct connection string. Please see this for more details:

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=335660&SiteID=1



  • mthomasq3

    Thanks for your answer, so, its impossible to use sqlclient for a smartphone , what should i use then whats the easiest way to connect to a SQL Database from a Smartphone

    Thanks a lot for the help, and sorry about the double post..

    Emmanuel.

  • ShivaanKeldon

    Yes, please follow troubleshooting procedure using link in my first post. (http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=270532&SiteID=1)

    Start with server configuration because SQL Express does not allow for remote connections by default.

    Next proceed to pinging and port scanning to make sure connection is physically possible.

    I's OK to use any IP as long as you could reach it.



  • Jacco Mintjes

    Thanks for your answer, so, its impossible to use sqlclient for a smartphone , what should i use then whats the easiest way to connect to a SQL Database from a Smartphone

    Thanks a lot for the help, and sorry about the double post..

    Emmanuel.

  • bingbangzoom

    Merging threads... Please do not cross post.

  • PaulMD

    Thanks for answering,what i want to do is access the database located in the PC (SQL Server 2005 Express) From the Smartphone device Emulator included with Visual Studio 2005, thanks fot the help.

    Emmanuel.

  • suneelb2b

    It is possible to use SQL Client on WM 5.0 SP with NETCF V2. On SP 2003 you can use usual trick with Web Service as a proxy.

    Create a simple WS which accepts query, connects to the database, gets data into DataSet and passes it to the device.

    Another web method would accept command and data from device so it would update/insert data in the database.



  • Ramanuj

    Thanks a lot for all your help, im slowly starting to understand Smartphone programming thanks to you, i have now installed the WM05 SDK and yes, actually SQLClient works great!, the only problem its that now it says:

    SQL Server does not exist or access denied.

    When i try to connect with this string:

    "Data Source=192.168.1.100,1433;Initial Catalog=cels;Persist Security Info=True;User ID=Celular;Password=celular"

    Should i change something its ok to use the intranet IP Adress, or should i use the internet IP

    Thanks again.
    Emmanuel.



  • SQL Express & SQLclient problem in VB2005