MySQL not working well on WM6 - Windows Mobile Development and Hacking General

Hi guys!
I'm trying to connect to a mySQL Databese from my Phone (to store highscores for a game).
I downloaded the MySQL .dll, which works fine in a "normal" C# windows app.
But when running the same conde on my mobile device I get an error.
Here's the code:
Code:
string myConnectionString = "SERVER=www.myserver.de;" + "DATABASE=testDatabase;" + "UID=myName;" + "PASSWORD=myPW;";
MySqlConnection connection = new MySqlConnection(myConnectionString);
connection.Open();
The dll I use is called "mysql.data.cf.dll".
The error I get is an "IndexOutOfRange Exception in the last line ("connection.Open();"). The whole thing compiles fine though...
Has anyone done this before? Where could the problem be?
Thanks!

Related

DllMain not run in windows mobile 5.0

It's seems DllMain won't run when a dll loaded by LoadLibrary in wm5.0.
The dll is very simple,complied by vs 2005 beta2,just a MessageBox in dllmain
I load this dll in another process,using the api loadlibrary,In windows mobile 5.0 ppc emulator,no dialog box appear,but you can see that dll.dll had been loaded with remote file viewer.In Pocket PC 2003 SE emulator,every thing is ok
anybody has any idea about it?
Thanks
dll.cpp
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
MessageBox(NULL,L"11",L"22",0);
return TRUE;
}
Hi,
There is no default entry point in a DLL. You are doing everything fine except you need to load the module (function) you want to call. I cant remember off hand the details but its LoadModule.
Look thought the documentation for calling a function in a dll some more.
Paul
psneddon said:
Hi,
There is no default entry point in a DLL. You are doing everything fine except you need to load the module (function) you want to call. I cant remember off hand the details but its LoadModule.
Look thought the documentation for calling a function in a dll some more.
Paul
Click to expand...
Click to collapse
Thanks for your reply.
I don't want to call any function,excep the default entry point DllMain when loading library.
There should be default entry point in the dll I complied,because in wm2003,everything is ok(Messagebox appears when loading or unloading library)
DllMain worked in my programs in 2K5. Maybe your messagebox appears behind today window? I never tried MessageBox in DLLs, but CreateFile worked fine.
oh right. Maybe I'm wrong - i always thought DLL's didnt have default entry points - I need to get reading the SDK's more
Paul
mamaich said:
DllMain worked in my programs in 2K5. Maybe your messagebox appears behind today window? I never tried MessageBox in DLLs, but CreateFile worked fine.
Click to expand...
Click to collapse
hi mamaich,what device are you using?Emulator?
I've tried in another way:return TRUE or FALSE in DllMain,then check whether the dll is loaded with remote process viewer.
In wm5.0 emulator,DllMain's return value is ingored,the dll is always loaded.And in wm2003 emulator,dll can be loaded only if DllMain's return value is TRUE
I've compiled the DLL with eVC4 and run it on XDA2 with WM5. That DLL was a part of a rather large project.
Maybe VS2005 produces incorrect DLLs?
mamaich said:
I've compiled the DLL with eVC4 and run it on XDA2 with WM5. That DLL was a part of a rather large project.
Maybe VS2005 produces incorrect DLLs?
Click to expand...
Click to collapse
The dll should be ok,it works well on ppc2003's emulator.I have also tried the dll produced by evc4.0.
Seems it's my fault,I got it work on wm emulator now
Thanks for all
I found it,dllmain not run just because the dll export no function.after add a not used fuction,MessageBox appear when loading

SQL Mobile not working on JasJar

Hi All,
I'm writing an app which uses an SQL Mobile DB on the JasJar. It works fine in the emulator, but as soon as I run on the JasJar I get the following message:
Unable to find PInvoke DLL sqlceme30.dll
The code which causes this is the first reference to a System.Data.SqlServerCe object.
I've searched for clues and tried manual installations of SQL Mobile Cabs on the device, I've tried putting the required DLL's into the project and marking them to be copied onto the device during deployment, and I've tried a factory reset. All of these (except the reset) get rid of the first error and give this one:
A SQL Mobile DLL could not be loaded. Reinstall SQL Mobile. [ DLL Name = sqlceqp30.dll ]
The code which causes this is the first call to execute a query against the DB. I've been unable to get any further than this.
I've tried to rule out device problems by performing the factory reset, and have also tried to rule out VS2005 configuration issues by running on the emulator.
Has anyone else had (and more importantly - solved ) this problem?
Many thanks for any help you can offer.
Regards
Alec
FYI This was solved by applying the latest ROM update.
Hi
just for information, this error may also appear if the DLL is loaded to late and the RAm would not be sufficient to load the dll

Error while starting app - System.data.sqlClient not found

Hi
I made small app which communicate with MS SQL server 2005. When i deploy app to my pocket pc the app runs perfectly. But when i build app and move it to my pocket pc and try to run it i get error "File or assembly name 'System.Data.SqlClient, Version 3.0.3600, Culture = neutral' or one of its dependencies, was not found". I have installed net 3.5 on my pocket pc. What should i do? tHx for help.
Anyone?
HI
you must install sqlce.ppc.wce5.armv4i.CAB in your ppc

Running .NET Compact Framework Application on WinXP

Some time ago i found out when you resolve the working dir with
Code:
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
and you run your program on a XP computer it crashes if you try to access a file with you AppPath String
this problem comes from that this code gives you the dir with a starting "file:\"
so just remove it and it is fine...
Here a VB.NET code for that
Code:
'Get the Startup Path
AppPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
If AppPath.StartsWith("file:\") Then
AppPath = AppPath.Substring(6)
'MsgBox(AppPath)
End If
You ask for what that is good for?
You can test your apps without an emulator, test if it works on any resolution or play around with you tablet pc

Encryption problems

Hi There,
We are working on an application that runs on both the PC and android that opens encrypted data. Our problem is, even when we are using the exact same code, the key generated under Android is different from the key generated under Linux PC. When we encrypt a file under android, we are able to decrypt it under android and the same for linux. However, if we try to decrypt a linux file under android, it doesnt work, and vice versa.
We have noticed that the provider for SecureRandom for android is Crypto, whereas for linux, it says SUN. I am wondering if this is the main cause? Here is a sample of our code with debug prints:-
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
SecureRandom secRandom = SecureRandom.getInstance("SHA1PRNG");
// This is where the provider between linux and android differs
System.err.println(secRandom.getProvider().getName());
And later down the code, after we generate we call generateKey and getEncoded, the hex values of the final key are different between android and linux.
Are there any suggestions on how we can get the final keys for both platforms to work?
Thanks in advance.

Categories

Resources