SQL problem

SQL problem

am 16.11.2005 15:12:41 von Mark Mchugh

Hi,
I am using the following code

Set hubsdb = OpenDatabase("", dbDriverComplete,
False,
"ODBC;DSN=mysqltest;UID=root;PWD=xli2310;Database=adjuster")

Set rs = hubsdb.OpenRecordset("select * FROM
personal WHERE general LIKE 'Personal%'",
dbOpenDynaset)


MsgBox (rs.RecordCount)


i get zero results back, but when i run the query in
the mysql control center, i get 10 results back.

when i change the above sql to "Select * from
personal" i get all the items from the table back.


strange?

is there a bug?


thanks

MArk




__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

RE: SQL problem

am 16.11.2005 16:49:12 von andy.lawton

The record count does not always give you the correct result.
Try rs.movefirst followed by rs.movelast and then check the record
count.
Or stick the results in a grid and see what's there.


Andy

-----Original Message-----
From: Mark Mchugh [mailto:mark_mch@yahoo.com]=20
Sent: 16 November 2005 14:13
To: mysql list
Subject: SQL problem


Hi,
I am using the following code

Set hubsdb =3D OpenDatabase("", dbDriverComplete,
False,
"ODBC;DSN=3Dmysqltest;UID=3Droot;PWD=3Dxli2310;Database=3Dad juster")
=20
Set rs =3D hubsdb.OpenRecordset("select * FROM
personal WHERE general LIKE 'Personal%'",
dbOpenDynaset)
=20
=20
MsgBox (rs.RecordCount)
=20

i get zero results back, but when i run the query in
the mysql control center, i get 10 results back.

when i change the above sql to "Select * from
personal" i get all the items from the table back.


strange?

is there a bug?


thanks

MArk


=09
=09
__________________________________=20
Yahoo! Mail - PC Magazine Editors' Choice 2005=20
http://mail.yahoo.com


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org

RE: SQL problem

am 16.11.2005 23:18:34 von jbonnett

I think the way you are doing it, you are using the older DAO approach
and the MSDOS style wildcards.

You need to write

Set rs =3D hubsdb.OpenRecordset("select * FROM
personal WHERE general LIKE 'Personal*'",
dbOpenDynaset)

If you were using ADODB then your wildcard would be correct.

? =3D _
* =3D %

John B.

-----Original Message-----
From: Mark Mchugh [mailto:mark_mch@yahoo.com]=20
Sent: Thursday, 17 November 2005 12:43 AM
To: mysql list
Subject: SQL problem

Hi,
I am using the following code

Set hubsdb =3D OpenDatabase("", dbDriverComplete,
False,
"ODBC;DSN=3Dmysqltest;UID=3Droot;PWD=3Dxli2310;Database=3Dad juster")
=20
Set rs =3D hubsdb.OpenRecordset("select * FROM
personal WHERE general LIKE 'Personal%'",
dbOpenDynaset)
=20
=20
MsgBox (rs.RecordCount)
=20

i get zero results back, but when i run the query in
the mysql control center, i get 10 results back.

when i change the above sql to "Select * from
personal" i get all the items from the table back.


strange?

is there a bug?


thanks

MArk


=09
=09
__________________________________=20
Yahoo! Mail - PC Magazine Editors' Choice 2005=20
http://mail.yahoo.com


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org