We help IT Professionals succeed at work.

Hoist the colors! We’ve added location flags to usernames sitewide, so it's easier to connect with the global community on EE. View My Profile

x

sql server 2000 Database access from pocket pc

sidNic
sidNic asked
on
10,207 Views
Last Modified: 2013-12-27
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.
Comment
Watch Question

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





This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
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

Commented:
You guys are making it too comlicated, just use a webservice.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.