0

I have a case here where I use excel files connected with ADO, it seems OK with excel 2003 files, however when I use excel 2007 or newer I get some problems receiving recordcount..

my connection string look like this for excel 2003 :

format('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;Extended Properties=Excel 8.0;',[filename])

and the same connectionstring for excel 2007 or newer (xlsx files)

format('Provider=Microsoft.ACE.OLEDB.12.0;Data Source=%s;Extended Properties="Excel 12.0 Xml;HDR=YES;IMEX=1"',[filename])

do I need something more here? or what am I missing to be allowed to use the recordcount, recno etc etc?

Community
  • 1
  • 1
Plastkort
  • 957
  • 1
  • 26
  • 40
  • How about telling us the precise error message? – David Heffernan Mar 21 '11 at 13:06
  • 1
    If `RecordCount` returns 0 or -1, then the behavior is not to be unexpected. If it's an error, then, like David, i'm curious to see the error. – Ian Boyd Mar 21 '11 at 13:13
  • As David and Ian said, "I get some problems" doesn't provide any information we can use to help. If you have a problem, you need to tell us what the problem is, and if you have an error you need to provide the exact error message. – Ken White Mar 21 '11 at 16:20
  • yep as lan mention, i get -1 as recordcount – Plastkort Mar 21 '11 at 21:04

1 Answers1

3

Have a look at this article: http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=33

Basically you need to set the CursorType to something other than ctOpenForwardOnly.

Jørn E. Angeltveit
  • 3,029
  • 3
  • 22
  • 53