Recent

Author Topic: Using SqlLinkCE (a VB.NET CE library) with Lazarus for CE  (Read 9261 times)

carlos.guerra@multilogix.

  • New member
  • *
  • Posts: 8
Using SqlLinkCE (a VB.NET CE library) with Lazarus for CE
« on: March 26, 2012, 04:59:17 am »
Hi all,

I'm testing a product called SqlLinkCE, it is VB.NET CE library, in VB.Net and other eVB based products like NSBasic/CE you only have to do an "import" and a "define" to use it, like this:

Imports SqlLinkCE
Private sqlLink As New GUI_SqlLinkCe


Could this library be use with Lazarus for CE?
 
I have done a quick test using the LoadLibrary function and it seems that the DLL loads but I'm totally lost on what to do next cause to access the properties and methods of this library you have to do the following:
 
sqlLink.Sql = "Select * from Clients"
sqlLink.Execute_Query()


The product website is http://www.gui-innovations.com/html/sqllinkce.html in case some of you want more information.

Hope someone knows this.

Regards

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Using SqlLinkCE (a VB.NET CE library) with Lazarus for CE
« Reply #1 on: March 26, 2012, 09:39:37 am »
You'd have to look at how those products use the dll.

If the dll does not provide a procedural/aka "C" interface, it won't work.

Don't know if it's possible to run freetds on wince, otherwise you could use the mssqlconn MS SQL Server connector (assuming you want to link to a remote MS SQL Server?)
For details, see the thread in the databases section
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

carlos.guerra@multilogix.

  • New member
  • *
  • Posts: 8
Re: Using SqlLinkCE (a VB.NET CE library) with Lazarus for CE
« Reply #2 on: March 26, 2012, 08:03:57 pm »
If the dll does not provide a procedural/aka "C" interface, it won't work.
Is there a way to know this?

Don't know if it's possible to run freetds on wince, otherwise you could use the mssqlconn MS SQL Server connector (assuming you want to link to a remote MS SQL Server?)
The advantage of this product is that it let you connect to any ODBC database on a server from CE , which for me is very useful because I need to develop applications for a lot of different and some times not that commercial databases like DBISAM, Pervasive, NexusDB, AdvantageDB, etc.

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: Using SqlLinkCE (a VB.NET CE library) with Lazarus for CE
« Reply #3 on: March 26, 2012, 08:47:16 pm »
If the dll can be used for eVB then it has probably a COM interface. If that is the case then you can use it through late binding:

Code: [Select]
var
  SqlLink:variant;
begin
  SqlLink:=CreateOleObject('SqlLinkCE');
  SqlLink..Sql := 'Select * from Clients'
  SqlLink.Execute_Query;
..

Before using the dll it has to be registered on the device with regsvrce.exe. If that succeeds it confirms that it is very probably a COM server.
I just guessed the class name 'SqlLinkCE'. If the registration worked you can look in the registry of the device and look up the real name in HKEY_CLASSES_ROOT. Replace the name you found in the call to CreateOleObject. If the class name is not correct CreateOleObject will raise an exception.

carlos.guerra@multilogix.

  • New member
  • *
  • Posts: 8
Re: Using SqlLinkCE (a VB.NET CE library) with Lazarus for CE
« Reply #4 on: March 26, 2012, 09:18:38 pm »
ludob thanks for the reply.

The SqlLinkCE team respond the following when a few days ago I ask how to install the DLL into the Device

"so how do I install/register the SQLLinkCE DLL library in the Mobile device?"

"You should just need to copy it  to the device – it shouldn’t need registering"

So I imagine it doesn't have a COM interface but I can do a quick test  following your example code.

carlos.guerra@multilogix.

  • New member
  • *
  • Posts: 8
Re: Using SqlLinkCE (a VB.NET CE library) with Lazarus for CE
« Reply #5 on: March 27, 2012, 08:19:02 pm »
If the dll can be used for eVB then it has probably a COM interface.....

Before using the dll it has to be registered on the device with regsvrce.exe. If that succeeds it confirms that it is very probably a COM server.

How do you register a dll under WinCE/WM?

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: Using SqlLinkCE (a VB.NET CE library) with Lazarus for CE
« Reply #6 on: March 27, 2012, 10:45:55 pm »
There is the regsrvce.exe tool that you run on your device and pass the name of the dll. http://social.msdn.microsoft.com/Forums/en/vssmartdevicesnative/thread/2faa88ac-4475-4b3a-b47e-ed6ae492e4e7
Alternatively you can do it from fpc by doing a LoadLibrary, a GetProcAddress(lib,'DllRegisterServer') and then call it.

carlos.guerra@multilogix.

  • New member
  • *
  • Posts: 8
Re: Using SqlLinkCE (a VB.NET CE library) with Lazarus for CE
« Reply #7 on: March 27, 2012, 11:21:08 pm »
Thanks a lot ludob!

But it  I'm getting an error trying to registered it,  this is the error:

"SqlLinkCE.dll was loaded, but the DllRegisterServer entry point was not found."
"DllRegisterServer may not be exported, or a corrupt version of SqlLinkCE.dll may Be in memory. Consider using PView to detect and remove it."

Could this be a definitive indication that this library cannot be used with Lazarus?

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: Using SqlLinkCE (a VB.NET CE library) with Lazarus for CE
« Reply #8 on: March 27, 2012, 11:38:17 pm »
Quote
Could this be a definitive indication that this library cannot be used with Lazarus?
Yep. The mention of eVB raised the hope that it was a VB6 style of COM server but it isn't.
You could ask the SqlLinkCE team if they have a C wrapper for the dll.
On PC's you can create COM wrappers for .net assemblies but I don't know if that is possible for CE/WM devices.

 

TinyPortal © 2005-2018