8 messages in com.mysql.lists.win32Re: VB Code works when connecting to ...| From | Sent On | Attachments |
|---|---|---|
| Greg Quinn | 06 Feb 2004 05:14 | |
| Mattias Göransson | 06 Feb 2004 05:27 | |
| Andrea Milani | 06 Feb 2004 06:17 | |
| PF: MySQL | 06 Feb 2004 07:21 | |
| victor fastrun | 06 Feb 2004 08:58 | |
| Greg Quinn | 06 Feb 2004 10:32 | |
| Greg Quinn | 06 Feb 2004 10:35 | |
| Mike | 06 Feb 2004 11:14 |
| Subject: | Re: VB Code works when connecting to MS SQL, but not MYSQL![]() |
|---|---|
| From: | Mattias Göransson (matt...@treudd.se) |
| Date: | 02/06/2004 05:27:40 AM |
| List: | com.mysql.lists.win32 |
I really cant tell you (not a VB-coder). If you got a recordcount using MS SQL you should get it in VB/ASP.
But take a look into cursorType. Depending of the cursortype it will return -1 or the current rows in the RS.
Might be something with the drivers. They might behave differently depending on db.
/mattias
Quoting Greg Quinn <gr...@i-online.co.za>:
I have this VB6 code, it basically opens a recordset, then returns the recordcount. It all worked fine when connecting to MS SQL server, but when I changed the connection string to point to the MySQL database, using the ODBC drivers, the recordset returns -1 as a rowcount.
I have confirmed the query being passed in my app, and it returns many rows, so why does the recordcount return -1??? I have tried different ways of connecting, different cursor types etc, but still the same problem.
Here is my code...
Set rs = New ADODB.Recordset Set cn = New ADODB.Connection
cn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=myServer;DATABASE=myDB;UID=root;PASSWORD=;OPTION=3;" cn.Open rs.CursorLocation = adUseServer rs.Open GetFolderQuery(mUserID, mFolderID), cn, adOpenStatic, adLockOptimistic
If Not rs.EOF Then rs.MoveLast 'Get the number of records in recordset mRowCount = rs.RecordCount rs.MoveFirst 'Retrieve records in a module level variant array used in 'unbound events mvarTrans = rs.GetRows(mRowCount) 'Get No of Columns mRecordsetCols = UBound(mvarTrans, 1) Else: mRowCount = 0 End If
rs.Close cn.Close
Mattias Göransson Treudd konsult www.treudd.se 070-440 1933




