Home > Software engineering >  Vb6.0 by use import excel2003 data, by using ado and mshfelxgrid controls appear sheet1 $is not a va
Vb6.0 by use import excel2003 data, by using ado and mshfelxgrid controls appear sheet1 $is not a va

Time:09-27

Masters, ask a question:
As title, I want to use an ado and mshflexgrid control to c: \ documents and Settings \ admin \ grades. The export data into mshflexgrid XLS, grades. XLS to sheet1, the name of the first table of procedure is as follows:
Dim cn as new adodb. Connection
Dim the rs as new adodb. You
Cn. The open ". The Provider=Microsoft Jet. The OLEDB. 4.0; Data Source="c: \ documents and Settings \ admin \. XLS"; Extended Properties='Excel8.0; HDR=yes; IMEX=1 '"
Rs. Open the "select * from [sheet1 $], cn, adOpenKeyset, adLockOptimistic
The set mshflexgrid1.
the datasource=rsRuntime error prompts "' Sheet1 $' is not a valid name, please make sure it does not contain invalid characters or punctuation, and the name is not too long" is the name of my watch Sheet1, how can the wrong? In addition, I also built a empty again excel table, the grades. XLS data is copied to the empty table, also not line, please analysis the reason,

CodePudding user response:

How no one reply! Death and so on!

CodePudding user response:

First confirmed. XLS in a Sheet1 page, rather than to other names,
The end of the second SQL statement (string) double quotation marks?
 rs. Open the "select * from [sheet1 $]", cn, adOpenKeyset, adLockOptimistic 

CodePudding user response:

Tiger_zhao hello! Thank you for reply!
1, my grades. The first form is indeed a sheet1, XLS then I built an empty excel, the grades. XLS copies the contents of the past, still the error,
2, "select * from [sheet1 $]" at the back of the "leakage wrote it when I was in the post, there is real, if it's convenient for you, can you try on your machine, look to whether can appear this problem, is I have a problem or a vb system has a problem?

CodePudding user response:

 cn. The open ". The Provider=Microsoft Jet. The OLEDB. 4.0; Data Source=D: \ temp \ book1 XLS. Extended Properties='Excel 8.0; HDR=yes; IMEX=1 '" 
Rs. Open the "select * from [sheet1 $]", cn, adOpenKeyset, adLockOptimistic
The Debug. Print rs. Get string ()

successful

CodePudding user response:

Tiger_zhao hello! Thank you for reply!
1, my grades. The first form is indeed a sheet1, XLS then I built an empty excel, the grades. XLS copies the contents of the past, still the error,
2, "select * from [sheet1 $]" at the back of the "leakage wrote it when I was in the post, there is real, if it's convenient for you, can you try on your machine, look to whether can appear this problem, is I have a problem or a vb system has a problem?

CodePudding user response:

So what's the problem?
I system before system32 missing several files inside, has installed a msexcl40. DLL. Related to this? That is the system has a problem,

CodePudding user response:

You must be the "optimization" version of the system/software development,
"Optimization" people with what sure is a feature of the "useless"?

CodePudding user response:

The
reference 7 floor Tiger_Zhao response:
must have the "optimization" version of the system/software development,
"Optimization" people with what sure is a feature of the "useless"?

This appears to be little, relationship... Streamlined system generally don't even install excel.

Actually general just a complete reinstall a 2003

Suggest the building under a full version of office to hold the excel look again
  • Related