MS SQL Library and Component Configuration

sbruno

Member
Licensed User
First, as a :sign0104: I am only lost for the moment... I hope...

Using the MSSQL.dll (Version 1.9) I am not certain which component settings are supposed to be correct. Or if there are other requirements to sucessfully compile on the desktop and successfully execute the finished app on the device.
Here is what I have done...

If I use MSSQL.dll (Version 1.9) with System.Data.SqlClient.dll on the Device-side and just MSSQL.dll on the Desktop side, I cannot compile and receive error:

Error compiling program.
Error message: error CS0234: The type or namespace name ‘MSSQLRemote’ does not exist in the namespace ‘MSSQL’ (are you missing an assembly reference?)


However, if I change back to MSSQL.dll (version 1.1) I can compile successfully and run the app from my desktop fine, but the app does not run on the Device (Windows ce.net 5.0) producing the error:

Error: Could not load type MSSQL.MSSQLRemote from assembly MSSQL...

Am I missing something? Is there a file missing?

Any information would greatly reduce the over confused path I have already taken and hopefully make this process clearer for others, as well.

Thanks in advance for your assistance!
 

agraham

Expert
Licensed User
Longtime User
You should have the same version of any library as both desktop and device components or you may get strange compilation problems. Also if the library is not merged (which MSSQL cannot be) the same version must be present in the application folder on the device. Version 1.9 is the only version of MSSQL.dll that will work correctly. It is compiled against Windows Mobile System.Data.SqlClient.dll version 3.0.3600.0 which needs to be present on the device and for which links appear in the threads on the forum. It should also run on the desktop against the desktop .NET Framework 2.0 System.Data.SqlClient.

If you are getting error references to "MSSQLRemote" you must still have the original MSSQL.dll somewhere as there is no such name in version 1.9.
 

sbruno

Member
Licensed User
Moving on to the next problem...

I removed all references of any older version of the MSSQL library and added the latest MSSQL.dll (version 1.9) to the Basic4PPC Desktop\Libraries folder. I also, re-estabilished the MSSQL component and created my object, which new referenced MSSQL and not MSSQLRemote. (thanks for clearing up that headache)

However, I cannot add the System.Data.SQLClient to the Desktop side of the components and receive error:

An Error has occurred.
An item with the same key has already been added.


If I exclude the library from the desktop side, I modified my program to utilize the new functionality and everything compiles and works fine on the desktop. When I deploy (with SetupBuilder and ezSetup to create and install exe files), the application fails to run on the Device.

Error: File or assembly name System.Data.SQLClient, version=3.0.3600.0, Culture=neutral, PublicKeyToken=3B... or one of its dependencies, was not found.

I did include the MSSQL.dll and the System.Data.SQLClient.dll files with the install, and they actually are on the device in the same directory as the app EXE. I also have Microsoft .NET CF 2.0 installed and appears okay. Do I have to install some other library or software or maybe put this file in a different location?

Once again, your help is requested.

Thanks for the assistance!
 

agraham

Expert
Licensed User
Longtime User
However, I cannot add the System.Data.SQLClient to the Desktop side of the components
You don't need to add it to either the desktop or device as a component as it is not a Basic4ppc library. It only needs to be in the same folder as the exe on the device.
 

sbruno

Member
Licensed User
Still no luck. I uninstalled Microsoft .NET CF 2.0, Basic4PPC Device, and my App. Reinstalled Microsoft .NET CF 2.0, Basic4PPC Device and my App.

When installing Basic4PPC device I receive a message that the software is not compatible... I also receive the same message when I deploy my app, but I assume that is just a warning... since, if I compile a simple non-SQL program it works fine, so the Basic4PPC is working as expected.

When running my app with the MSSQL library, I still get the same message:

Error: File or assembly name System.Data.SQLClient, version=3.0.3600.0, Culture=neutral, PublicKeyToken=3B... or one of its dependencies, was not found.

There was a reference to some CAB file which Moroz indicated that it fixed his problem but, did not explain how or what he did. http://www.b4x.com/forum/additional-libraries/6184-mssql-sql-server-library-2.html#post40906 but, can't do anything with that file anyway.

The System.Data.SQLClient.dll file does exist on the device. The files was take from the link you referenced (which I will assume is version 3.0.3600.0) however, the file version indicates 1.0.2268.0 in Windows XP Pro or did I find and old library file?

My device is an MC9090 Motorola/Symbol running Windows CE.net 5.0 in case that matters, as well.

Thanks again for your help and patience.
 

agraham

Expert
Licensed User
Longtime User
If you copied that CAB file to your device and double clicked on it it would install system.data.sqlclient.dll to your device system folder. I assume that it contains the correct version as it worked for him.

However I've posted the actual System.Data.SqlClient.dll that the library is compiled against in the first post of the library thread. I think you got an earlier version file on your device.
 

sbruno

Member
Licensed User
Thanks! I am now one step forward. :sign0060:

The link which is listed in your comment indicates to download the file which I did, (but clicked the link), that was a reference to an old System.Data.SQLClient. If I would have looked a few lines below that, in the attaced files area, there it was waiting to be selected all along.

App now running on the device... but :sign0161: I get nothing from the MS SQL server. I checked the LastError which returns a whole bunch of messages:

LastError: System.MissingMethodException: Can't find PInvoke DLL dbnetlib.dll, at System.Data.SqlClient.TdsParser.Connect() at System.Data.SqlClient.SqlInternalConnection.OpenAndLogin() at System.Data.SqlCleint.SqlInternalConnection..ctor() and on and on...

Would you know if this is related to authentication, other missing dlls or something else?

Again I only have .NET CF 2.0 do I need .NET CF 3.5? Before I make a mess again.

I really appreciate all your help and quick response. Thanks and Have a Happy New Year!
 

sbruno

Member
Licensed User
Thanks once again! It finally works.

My device Motorola MC9090 operating Windows CE.net 5.0

Installed the SQL.wce5.armv4i.cab (copied to the device my documents folder and double click, installed) corrected my problem.

The above file was already on my system located under c:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\SQL Server\Client\v2.0\wce500\armv4i. I just do not know how I got Visual Studio 9.0? Either part of an SDK or MS Visual Studio Express since I do not have the full MS Visual Studio Express.

Thanks again for the direction.
 
Top