Sign in to follow this  
minhtham

read data from mysql database

Recommended Posts

i have a problem when i read data from mysql.

when i used "global qr = db.Query(dbase,"SELECT name FROM alarmlog limit 100;")" ,it is no problem.

but    i used  "     global qr = db.Querytoclass(dbase,"SELECT name FROM alarmlog limit 100;")",DAQ is close.

qqq.png

Share this post


Link to post
Share on other sites

myObject = new(MyClassType)

QueryToClass(dshandle, "SELECT Name, Address FROM myTable", myObject)

"MyClassType"   What is defined?

Share this post


Link to post
Share on other sites

For the first post: MySQL or MSSQL?  Also, does it crash if you drop the "limit 100"?  I can't seem to reproduce.  Also, what release of DAQFactory?

For the second part, MyClassType would be a class that you had defined.  In general you do not need to give QueryToClass an object.  It will create one with member variables for all the fields and a few extras (fieldnames, etc.).  But if you want this data injected into a class that you created that might have a bunch of member functions, then you would want to pass an instantiated object of that class.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this