Link to home
Start Free TrialLog in
Avatar of sidNic
sidNic

asked on

sql server 2000 Database access from pocket pc

I'm currently evaluating whether to develop a stock control system using pocket pc 2002

i've downloaded embedded visual basic to develop this with. At present i'm only using an emulator.

I'm trying to connect to a sql server 2000 database on our main server.
The pda would be on a wireless network so it should be able to connect direct to the database.

Is it possible to talk directly to sql server? I've seen many posts which just relate to sql server ce which i dont think is suitable.

does anyone have an example of how to connect using adoce to the db? the connection string i use on our normal vb apps doesnt work.
Avatar of prakash_raj
prakash_raj

Hi,

Did you already try the VB Sample DatabaseViewer??

Cheers,
Prakash
Hi,

yes its possible, you have to use RDA. Try use the source bellow, i use it on my Project and works well.


ISSCERDA* CERDA;
WCHAR    wszConnectString[512];  // Persists the RDAConnectionString
WCHAR    wszLocalTable[255];     // Persists the RDALocalTable
WCHAR    wszErrorTable[255];     // Persists the RDAErrorTable
BSTR     wszQuery;
HRESULT hr;
CLSID tClsid;
hr = CLSIDFromProgID( _T("SSCE.RemoteDataAccess.2.0"), &tClsid );
if (FAILED(hr))
      return false;
hr = CoCreateInstance(
      tClsid, //  CLSID_RemoteDataAccess
      NULL,
      CLSCTX_INPROC_SERVER,
      IID_ISSCERDA,
      (LPVOID *)&CERDA);
if(FAILED(hr)) return false;
hr = CERDA->put_InternetURL(L"http://host/sqlremote/sscesa20.dll");
if(FAILED(hr)) return false;
hr = CERDA->put_InternetLogin(L"host\\user");
if(FAILED(hr)) return false;
hr = CERDA->put_InternetPassword(L"----");
if(FAILED(hr)) return false;
hr = CERDA->put_LocalConnectionString( L"Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\\db.sdf" );
if(FAILED(hr)) return false;
wcscpy(wszConnectString, L"Provider=sqloledb;Initial Catalog=dbname;Data Source=host;UID=sqlUser;password=pwd");
wcscpy(wszErrorTable, L"ErrorTable");
CString csQuery = L"Select * from table";
wszQuery = csQuery.AllocSysString();
wcscpy(wszLocalTable, TABLE_NAME);
hr = CERDA->Pull(wszLocalTable,      wszQuery, wszConnectString,      TRACKINGOFF, wszErrorTable);
if(FAILED(hr) return false;

Daniel Junges





ASKER CERTIFIED SOLUTION
Avatar of Backflipping
Backflipping

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello Tim,
I'm trying to do the same thing with my WiFi Palm.  Do you mind showing me your sample code?  
Your help would be greatly appreciated.

Thanks
Norm Nguyen
You guys are making it too comlicated, just use a webservice.