View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
T. S. T. S. is offline
external usenet poster
 
Posts: 2
Default RecordCount not working

I am trying to read data from a mysql database from within an excel
makro.
My problem is, that no matter if I get data (i know there are several
records returned, because I can output fields' values) or not -
recordcount is always -1

Example:
--

Dim link As New ADODB.Connection


link.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=localhost;" _
& "DATABASE=test;" _
& "UID=root;" _
& "PWD=secret;"

link.Open
Set rs = New ADODB.Recordset
query = "select * from mytable"
rs.Open query, link
MsgBox rs.RecordCount ' -1
rs.movefirst
msgbox rs.fields"name" ' jim

rs.close
link.close

--

I can't see where I deviated from the mysql odbc reference.... they
also use recordcount....
http://dev.mysql.com/doc/refman/5.0/...ogramming.html

Thx in advance..