-
(1) Can you guys check out this thread and try to answer it?
http://forums.vb-world.net/showthrea...threadid=28698
(2) I know what DAO is and how to use it, but can anyone explain to me what ADO is and how to use it?
I posted the first wuestion in the Database section, but didn't get a lot of response.
Thanks!
-
here you go
SQL = "SELECT * FROM MyTable WHERE ID =2"
if ID is a text field
you go
SQL = "SELECT * FROM MyTable WHERE ID = '2'"
sql is almost identical accross all platforms, applications..
second part:
ADO is way of accessing db, DAO is too
but MS wants you to use ADO from now on
ado is faster, and its better because there is more support for it)
there is a lot of threads explaining their differences..
-
kovan: It still returns only the first record with the specified ID :(
Any ideas?
-
kovan: what references/components should I use for ADO? and what's the latest version?
-
If you are running VB6 with Service Pack 4, you should have ADO 2.5.
The reference is "Microsoft ActiveX Data Objects 2.5 Library".
-
Sc0rp - How have you checked that only one record is coming back ? The SQL looks fine that everyone has provided. Try this and let us know the answer :
Code:
rsTemp.MoveLast
MsgBox rsTemp.Recordcount
If it returns 1 then check you're not running the SQL against a query which uses SELECT DISTINCT * FROM table because that may be filtering out the duplicate rows before your SQL is run against it.
-
Oh.
I didn't use the MoveLast method.
Why do I have to do that?
If I load a database using OpenDatabase the recordcount property returns the right value, even after MoveFirst, or MoveNext.
-
use the sql i gave
and do the following
Code:
while not rs.eof
listbox1.additem !Name
rs.moveNext
wend
that will put all the names that sql returns
you weren't looping
you have to loop to get all
[Edited by kovan on 08-30-2000 at 12:33 PM]
-
Kovan, you'll need a movenext in your while statement or it'll become an infinite loop...
-
stupid me
hehe
ya,
ther is one now