|I know this is a webmaster forum but.|
I need some help!
Hi there fellow webmasters!
I have a question; Does anyone know any Visual Basic 6 (VB6), as I have a project that I cannot fathom out the mysql call on - I can retrieve single records but not multiple rows, I have searched for VB6 forums but there are non that I can find that are giving me useful advice.
Anyone have any ideas, as I am stumped. And I'm not used to that ;-p
Mysql or access? Being an M$ product, I've only worked with it on access databases, the select statements are slightly different but it's still SQL. You could try the .net area?
VB6 uses ADO and ODBC to get to any database. The SQL is whatever your database needs to see. Data is returned via recordset objects. If you want to iterate through the rows, use the recordset.movenext method. Another alternative (and faster) is to push all of the results into a 2 dimensional variant array by using recordset.GetRows - then loop through the array. The first index is the column number and the second is the row number. Both indexes will be 0-based.
Bottom line is that you should search for help on the ADODB.RecordSet object.
Hi there all,
Mysql is my flavour of DB - access - ack ;) You can't have multiple users logged into an access db to view records, else the GUI locks, mysql you can, flexible friend :)
Thanks for the advice there, that actually makes sense, the sql query functions fine, and only ever returns 1 result (the first record!) I cannot seem to get it to loop, even with movenext.
Maybe too obvious, but have you tried executing the actual SQL query through another channel to verify that more than 1 row should be returned?
Hi there LifeInAsia,
Yes, I have mysql query browers running, which is more strict than phpmyadmin, and is easier to get working ;)
Apologies though, at some ungodly hour this morning, I cracked the issue, after extensive reading of the mysql website for the ADO topics, there is an obscure link/paragraph that pointed me to a sollution. With VB6->Mysql you have to instruct the query to 'allow' more than one row to be returned, else the RecordCount/RecordSet object will always return -1, which means that the server hasn't received the instruction to say 'Show all records'. So I amended my object to: ComboQuery.adUseClient before the query was exectued, and now the result returned is correct, all 4 rows are there. Woo!
So thanks for your replies/help, again I know this is a webmaster forum, but I couldn't see the harm of posting.
Cheers from a very chuffed VB6 programmer! (I really had better migrate to .NET now too :))