VB6 using DAO
am 24.03.2006 18:09:58 von Jon Riesenweber
------_=_NextPart_001_01C64F65.CB59DF56
Content-Type: text/plain;
charset="windows-1250"
Content-Transfer-Encoding: quoted-printable
Hello,
=20
I=92m a newbie to this compiled code world so go easy on me. I am trying =
to convert an app to MySQL from exchange using DAO. I know that ADO is =
far better for this situation, however I have to do it with DAO before =
they will let me convert the entire thing over to ADO. I have done most =
of the converting but I am stuck on the SEEK method. I am trying to =
replace the Seek method with findFirst but the logic is screwing me up =
right now. Here=92s the call I am trying to replace. CurDataTbl.Seek =
"=3D", DispCtl("UnitCtlNo"), DispCtl("DataFieldNo" and SensorTbl.Seek =
"=3D", DispCtl("Sensor"). Here is what all of that is defined as.
=20
For the first:
Set CurDataTbl =3D DB.OpenRecordset("CurData", dbOpenDynaset) =
'CurDataTbl =3D Table for detail data (Data table)
Set DispCtl =3D DB.OpenRecordset("SELECT * FROM DisplayCtl WHERE =
UnitCtlNo =3D " & UnitCtlfld & " And (AveragedField =3D True Or =
TotaledField =3D True Or CurrentIsHistory =3D True Or DataEntryField =
=3D True)", dbOpenDynaset)
=20
And for the second call:
Set SensorTbl =3D DB.OpenRecordset("Sensor", dbOpenDynaset) 'SensorTbl =
=3D Table for Sensor data (Sensor table)
Set DispCtl =3D DB.OpenRecordset("SELECT * FROM DisplayCtl WHERE =
UnitCtlNo =3D " & UnitCtlfld & " And (AveragedField =3D True Or =
TotaledField =3D True Or CurrentIsHistory =3D True Or DataEntryField =
=3D True)", dbOpenDynaset)
=20
PLEASE HELP!!!
=20
Thanks!
=20
Jon
--=20
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.1/291 - Release Date: 3/24/2006
=20
------_=_NextPart_001_01C64F65.CB59DF56--
RE: VB6 using DAO
am 24.03.2006 18:25:25 von mberman
Hi Joe,
It looks like that in both call in second set statement you are using a
variable DispCtl and table name DispCtl :
* in Set DispCtl before "=3D" sign
* And in SELECT * FROM DisplayCtl WHERE after "=3D" sign
Mikhail Berman
-----Original Message-----
From: Jon Riesenweber [mailto:jonR@prorefrigeration.com]=20
Sent: Friday, March 24, 2006 12:10 PM
To: myodbc@lists.mysql.com
Subject: VB6 using DAO
Hello,
=20
I'm a newbie to this compiled code world so go easy on me. I am trying
to convert an app to MySQL from exchange using DAO. I know that ADO is
far better for this situation, however I have to do it with DAO before
they will let me convert the entire thing over to ADO. I have done most
of the converting but I am stuck on the SEEK method. I am trying to
replace the Seek method with findFirst but the logic is screwing me up
right now. Here's the call I am trying to replace. CurDataTbl.Seek =
"=3D",
DispCtl("UnitCtlNo"), DispCtl("DataFieldNo" and SensorTbl.Seek "=3D",
DispCtl("Sensor"). Here is what all of that is defined as.
=20
For the first:
Set CurDataTbl =3D DB.OpenRecordset("CurData", dbOpenDynaset)
'CurDataTbl =3D Table for detail data (Data table)
Set DispCtl =3D DB.OpenRecordset("SELECT * FROM DisplayCtl WHERE =
UnitCtlNo
=3D " & UnitCtlfld & " And (AveragedField =3D True Or TotaledField =3D =
True
Or CurrentIsHistory =3D True Or DataEntryField =3D True)", =
dbOpenDynaset)
=20
And for the second call:
Set SensorTbl =3D DB.OpenRecordset("Sensor", dbOpenDynaset) 'SensorTbl =
=3D
Table for Sensor data (Sensor table)
Set DispCtl =3D DB.OpenRecordset("SELECT * FROM DisplayCtl WHERE =
UnitCtlNo
=3D " & UnitCtlfld & " And (AveragedField =3D True Or TotaledField =3D =
True
Or CurrentIsHistory =3D True Or DataEntryField =3D True)", =
dbOpenDynaset)
=20
PLEASE HELP!!!
=20
Thanks!
=20
Jon
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.1/291 - Release Date: 3/24/2006
=20
--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=3Dgcdmo-myodbc@m.gmane.o rg
RE: VB6 using DAO
am 27.03.2006 00:40:32 von jbonnett
According to the MS help you can only use Seek on a table recordset, so
you should have: -
Set CurDataTbl =3D DB.OpenRecordset("CurData", dbOpenTable)
Not dbOpenDynaset
The Seek method is a bit of an odd one, made possible by the assumption
that Access is a dedicated desktop database and exposing some of the
inner workings of the database engine. It positions a recordset at a
particular record and allows you to move backwards or forwards from that
point. This is not the sort of thing a client server database like MySQL
wants to do because it implies a longer term stateful connection between
the client and server.
It might depend on what the exact logic is surrounding the bit you have
shown us. If the intention is just to find a specific record and not to
move about relative to that record, then just open a recordset with a
query that includes all the seek conditions. You will have a join in
that query to include the other table. The recordset may return a single
row or perhaps several if there are duplicate keys. If there are
duplicates, to simulate what seek does, you only want the first one and
the query would need to contain a suitable "ORDER BY" clause to get the
same record as seek. With MySQL you could use "LIMIT 1" to just get the
one record you want.
If you need to be able to move around the recordset relative to that
initial seek then simulating that with MySQL is possible but the code
you need to manage that nicely might be quite considerable.
You need to remember DAO is rather specific to the Access Jet database
engine and assumes things that really only apply in that case. This is
why ADO was created to work with more general database environments,
particularly client server ones like MySQL.
John B.
-----Original Message-----
From: Jon Riesenweber [mailto:jonR@prorefrigeration.com]=20
Sent: Saturday, 25 March 2006 3:40 AM
To: myodbc@lists.mysql.com
Subject: VB6 using DAO
Hello,
=20
I'm a newbie to this compiled code world so go easy on me. I am trying
to convert an app to MySQL from exchange using DAO. I know that ADO is
far better for this situation, however I have to do it with DAO before
they will let me convert the entire thing over to ADO. I have done most
of the converting but I am stuck on the SEEK method. I am trying to
replace the Seek method with findFirst but the logic is screwing me up
right now. Here's the call I am trying to replace. CurDataTbl.Seek =
"=3D",
DispCtl("UnitCtlNo"), DispCtl("DataFieldNo" and SensorTbl.Seek "=3D",
DispCtl("Sensor"). Here is what all of that is defined as.
=20
For the first:
Set CurDataTbl =3D DB.OpenRecordset("CurData", dbOpenDynaset)
'CurDataTbl =3D Table for detail data (Data table)
Set DispCtl =3D DB.OpenRecordset("SELECT * FROM DisplayCtl WHERE =
UnitCtlNo
=3D " & UnitCtlfld & " And (AveragedField =3D True Or TotaledField =3D =
True
Or CurrentIsHistory =3D True Or DataEntryField =3D True)", =
dbOpenDynaset)
=20
And for the second call:
Set SensorTbl =3D DB.OpenRecordset("Sensor", dbOpenDynaset) 'SensorTbl =
=3D
Table for Sensor data (Sensor table)
Set DispCtl =3D DB.OpenRecordset("SELECT * FROM DisplayCtl WHERE =
UnitCtlNo
=3D " & UnitCtlfld & " And (AveragedField =3D True Or TotaledField =3D =
True
Or CurrentIsHistory =3D True Or DataEntryField =3D True)", =
dbOpenDynaset)
=20
PLEASE HELP!!!
=20
Thanks!
=20
Jon
--=20
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.1/291 - Release Date: 3/24/2006
=20
--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=3Dgcdmo-myodbc@m.gmane.o rg