|
|||
|
There are two ways as follows:
The first way is to use the ActiveXObject method. To use this method, you would have to make sure that the end users have the Microsoft Excel installed. The object model of excel can be found at http://msdn.microsoft.com/library/de...tionobject.asp The second way is to use ADO, as you handle a .mdb database. A reference can be found at http://support.microsoft.com/default...b;EN-US;257819 In this way, the end users only need to install the jet driver. If you have any questions, please feel free to let us know. |
|
|||
|
We recommend the way of accessing excel files through ADO, because this way has two main advantages. The first one is that the end users will run your application without Microsoft Excel. The second one is that it is very easy to change the back end of your application. For instance, you may easily change your data file from access or firebird to excel, and vice versa.
Please try the following sample, which is converted from our access db sample. The only changes are: 1. the connect string 2. the method to update data. The Update command of SQL doesn't work for a .xls file, so we use the Recordset.update method instead. exe src |
|
|||
|
i dont knw much about the inner working...but the .exe does not work if u run it / the fields are displayed as undefined.
If however u open the excel file. Then run the program, the program will show the fields correctly. |
|
|||
|
i found the select query doesn't work when i use
Code:
record.Open("select id,name,age,sex,score from [Sheet1$]", conn, 1, 2);
Code:
record.Open("select * from [Sheet1$]", conn, 1, 2);
But I can't figure out how to let the update query work. |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|