Share: Using adoce to access the ACCESS database in EVC)

Source: Internet
Author: User
Tags ming microsoft website
Access the database using adoce in EVC

I just started to develop PPC applications. Considering that I am familiar with the c ++ language, I chose the evc4.0 + Pocket PC 2003 SDK development environment. I'm glad that many things are almost the same as VC ++ 6.0, and they get started quickly. However, we encountered difficulties in database development.

At first, I chose the database that comes with wince. The implementation is naturally very simple. However, later, it was found that there were some difficulties in synchronizing the databases that come with Wince with those in the PC. First, ActiveSync does not support it. Do you need to write the conversion interface yourself? It seems that it is not feasible. As a result, I am depressed and have been searching for relevant information online. Search by Google and by Baidu.

Finally, I found the dawn of hope on zuilang's blog. His article titled "difficult process: Using adoce in EVC" sets a way for me to access the ACCESS database with adoce. The Access database is a common database type on the PC. SQL Server 2000 can convert some data tables into accessible databases with the suffix. MDB.

In the reply to this blog, I was surprised to find that, in the post replied by the bookboy Macintosh at 11:22:32, I specified the specific method for evc4.0 + adoce3.1 to access the database. After reading the post, I was excited and started to practice it immediately. As prompted by the Macintosh, it is still relatively smooth to proceed step by step. In fact, the Macintosh has already made it very clear. I just did validation here.

 

 

1. Go to the Microsoft website to download the adoce3.1 installation package. The link is:

Http://www.microsoft.com/downloads/info.aspx? Bytes

The name is very tedious. Fortunately, it is just a link. Click it and you will be OK.

2. voado is a convenient adoconnection and adorecoedset class developed by Vos. The download link is:

Http://www.voscorp.com/products/developer/winmobile/voado/voado.zip


Ii. file generation, modification and download

1. Generate the adoce31.h and adocec31.h files

Under the adocepb/Setup/Data Access 3.1/program files/dataaccess31/include directory of the adocepbzip installation package of Microsoft, there are two files: adoce31.idl and adocec31.idl. In the command line status, enter the directory, and then execute midl adoce31.idl and midl adocec31.idl to generate the adoce31.h and adocec31.h files. Note: You must enter the adocepb/Setup/Data Access 3.1/program files/dataaccess31/include directory. Otherwise, execution of midl adoce31.idl and midl adocec31.idl will fail, the prompt may be that 'midl 'is not an internal or external command, or a program or batch processing file that can be run.

2. Modify the voado File

According to the adoce31.h and adocec31.h files, we must modify the downloaded voado and change the ADO ** 30. h to ADO ** 31.h.

In the vorecordset. cpp file, change tchar * cvorecordset: g_progid = text ("adoce. recordset.3.0") to tchar * cvorecordset: g_progid = text ("adoce. keystore ").

3. Download .dlland regsvrce.exe to the target device.

Copy the. dll file under adocepb/Setup/dataaccess3.1/program files/dataaccess31/device/ARM/sa1100/CE/retail to the/Windows Directory of PPC.

Copy the regsvrce.exe file under the program files/Microsoft Embedded C ++ 4.0/EVC/wce400/target/armv4 folder to the same folder as the database program on the device.

Iii. Precautions in programming

1. dll Registration

To use voado in our database program, you must first register these DLL. For example, in the oninitdialog () function, you can use the following statement to register the DLL:

CreateProcess (_ T ("/regsvrce"), _ T ("/S/Windows // adoce31.dll"), null, null );

CreateProcess (_ T ("/regsvrce"), _ T ("/S/Windows // adoxce31.dll"), null, null );

CreateProcess (_ T ("/regsvrce"), _ T ("/S/Windows // adocedb31.dll"), null, null );

CreateProcess (_ T ("/regsvrce"), _ T ("/S/Windows // adoceoledb31.dll"), null, null );

CreateProcess (_ T ("/regsvrce"), _ T ("/S/Windows // msdaer. DLL "), null, null );

CreateProcess (_ T ("/regsvrce"), _ T ("/S/Windows // msdaeren. DLL "), null, null );

CreateProcess (_ T ("/regsvrce"), _ T ("/S/Windows // msdadc. DLL "), null, null );

CreateProcess (_ T ("/regsvrce"), _ T ("/S/Windows // msdaosp. DLL "), null, null );

2. file includes

Add the modified adoce31.h and adocec31.h files to our project.

3. File placement on the target device

According to the preceding requirements, we need to place the database file and regsvrce.exe of the executable file. exeworkflow operation in the same folder. Otherwise, the database will not be accessible.

4. Before the database operation statements, I performed operations in the standard SQL language. For example, if I want to select all the information whose name field is "Zhang Ming" from the personinfo table of the account database, the standard SQL language should be like this: "select * from [account]. [DBO]. [personinfo] Where [account]. [DBO]. [personinfo]. [name] = 'zhang ming' ", from the actual debugging situation, if you follow this syntax, it cannot be opened correctly. Later, I made a random guess and tried it out. The statement that can be executed is as follows: "select * From personinfo where name = 'zhang ming'". Of course, this is just my own guess, I don't know how to use the correct syntax. This is still to be verified.

 

I. Resource requirements

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.