Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - When importing excel in VB6.0, "Cannot find an insertable ISAM" appears?
When importing excel in VB6.0, "Cannot find an insertable ISAM" appears?
Microsoft. Jet.OLEDB.4.0 doesn't seem to support Excel, so it can be accessed by DAO.

First, you need to refer to the Microsoft DAO 3.6 object library.

Dim DB As DAO。 Database database

Dim RS is the way. Record set

Set DB = OpenDatabase("d:\ data。 Xls ",false, false," Excel 8.0 ")

Set RS = DB. OpenRecordset ("file $ ")

Set DataGrid 1. Data source = RS

It seems that those who can't find an insertable ISAM just don't support this data format.

Sorry, I just looked at it. Datagrid only supports ado datasource. If you must use controls to bind, you can use Miscrosoft FlexGrid, and you can bind dao's datasource.

If you just want to display it, I suggest that you don't bind a ListView control on the form, then change the view mode to lvReport in the ListView property, and add the column title to correspond to the columns of Excel one by one. The code is as follows

Dim DB As DAO。 Database database

Dim RS is the way. Record set

Set DB = OpenDatabase("d:\ data。 Xls ",false, false," Excel 8.0 ")

Set RS = DB. OpenRecordset ("file $ ")

Dim li as ListItem

List view 1. List items. clear away

Do it until RS. eof

Set li = ListView 1. ListItems.Add(,,(RS(0))

For i = 1 to RS. Field. Count-1

Li. Sub-item (1) = Rupee (1)

then

RS。 next step

ring