ASP OLE Import of access files with named areas : formules in column title

T

The_Fakir_42

Hi,

I have a very tricky problem...

I import an XLS file from my asp web application; this xls file
contains lots of single-cell named areas.
Usually, I know how to get them, this way :

' Create temporary dataset
Dim ds As New DataSet
' Get the nammed area
Dim myData As New OleDbDataAdapter("SELECT * FROM Name_Of_Area",
OleConnectionToAccessFile)
myData.TableMappings.Add("Table", "Name_Of_Area")
' Fill the temporary dataset
myData.Fill(ds)
' As the first row is always assumed as containing the names of the
columns of the zone
' If I get the first column name of the resulting dataset, I get the
value I want.
Return ds.Tables("Name_Of_Area").Columns(0).ColumnName

THIS WORKS FINE....MOST OF THE TIME...
The problem I have is that in my access file, one of the named areas
contains the date value [12/10/2006]
If I use the code above, it returns [F1]
If I put a quote juste before my date in the access file (e.g.
['12/10/2006]) to tell Access it's a string, it works back again,
returning [12/10/2006] (and I have the same problem if the cell
contains a formula)
The problem is that this access file is meant to be filled by lots of
users and I can't ask them to put a quote before each date they enter.

When I import a bigger named area which have more than 1 row, all
subsequent rows are correctly retrived because they are part of the
data of the table that is assumed by OLDEB in the named area. only the
first row has problem because OLEDB wants column names and nothing else
in this first row.

MY QUESTION :
How can I force OLEDB to NOT import column names from my nammed area
and start importing data from the very first row.
I can NOT change my nammed zone my moving it 1 row upwards and
increasing its height, this is not an option.

Thank you for your answers !!
 
T

The_Fakir_42

Hi again,

I have found my problem (and solution) by searching then msdn documentation

On the connexion string, I just added HDR=No parameter (like IMEX=1) to tell
access NOT to return column names.

As usual, this was a RTFM case !!

Bye
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,108
Latest member
AlbertEste
Top