Not Get Table Name from ODBC-Sql Server Database(*.mdb) Or(*.xlsx)


Zeal

Recommended Posts

I have a database and i am able to read write the data in tables of database.

Now i want all tables name in DAQFactory.

so, how to get table name in String Channel using sql query?

Following query i try but not work

qr = db.Query(dbase,"SELECT name FROM sys.Tables")

Link to comment
Share on other sites

That is going to depend on the database you are using, not DAQFactory.  Test your select statement in your databases user interface / command line tool first to make sure it works, then try it in DAQFactory.  Also, I recommend using db.queryToClass() instead of db.Query().

Link to comment
Share on other sites

  • 3 years later...

Thank you for the response, but I would like know the difference between  both the query.

And what exactly is the usage of db.queryToclass().

Also can I know the status of database(like open,close).

Link to comment
Share on other sites

A regular query() returns a record set that you then need to traverse to read each record.  Because DAQFactory is an interpreted language this is quite slow, so we came up with QueryToClass(). This function instead returns an object with member variable arrays for each of the fields across all records.  This is much, much faster.  In addition, two member variables, classNames, and recordCount are returned.  The details of this function are described in section 9.5 of the user's guide.  With the new QueryToClass() there really are only a few use cases where the regular Query() should be used, usually ones that involve aggregate functions.

You can telll if open() worked by whether you get 0 for a handle (failed) or another number.

Once it is open you can't tell except that your database commands will throw an error, which you can then catch.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.