ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

取消
显示结果 
搜索替代 
您的意思是: 

having trouble with database variant to data

已解决!
转到解答

Here is a VI that i am trying to put together. I am trying to connect to a remote SQL database and run queries. I can connect retreive the data, but i cannot use the database variant to data. I am really green with this whole procces.

 

Please help,

0 项奖励
1 条消息(共 11 条)
3,997 次查看
解答
接受人 TRAVO

The output of the Fetch All function is a 2D array of Variant.  The Variant to Data function only takes in a single value.  Put the function inside 2 nested loops to convert each element in the 2D array to a data type.  Rebuild the array by enabling indexing on the exiting of the loops.

 

VariantData.png

- tbob

Inventor of the WORM Global
2 条消息(共 11 条)
3,993 次查看

Look at the shipping examples, specifically:

examples\database\Read All Data.vi

The examples are found by selecting Help-> Find Examples... and entering a keyword of 'database'.

 

 

If all you want to do is display the contents of a table, there is a function used in the vi above called

vi.lib\addons\database\Auxilliary.llb\DB Tools Select All Data.vi

that returns a 2D array of strings. This specific VI is not in the palettes and must be copied from the example or placed by using  Select a VI... from the top of the palettes menu.

Message Edited by Phillip Brooks on 04-06-2010 02:20 PM
0 项奖励
3 条消息(共 11 条)
3,983 次查看

I am actually trying to connect, query and then use the query as an array for other VI's.

 

 

0 项奖励
4 条消息(共 11 条)
3,975 次查看

TRAVO,

 

There is a new feature in Database Connectivity Toolkit in 2010 that can convert that array into specified data type you want directly. You can try it in LabVIEW platform 2010 beta.

Message Edited by Neil Li on 04-07-2010 09:49 AM
0 项奖励
5 条消息(共 11 条)
3,945 次查看

I have 8.5.1 will this matter? Also, it would be nice if I could see the master with all the other database's and tables, and maybe keep a session open for queries rather than having to re-open the connection.

 

I appreciate the help 

0 项奖励
6 条消息(共 11 条)
3,941 次查看
Sorry, Database Connectivity Toolkit 2010 can only be installed against LabVIEW 2010, so you can't use it with LV 8.5.1. I don't understand your second question very well. Do you mean after opening a connection you want to switch to another database which isn't specified as the master in the connection string. Which DBMS are you using? Can you paste your connection string for reference?
Message Edited by Neil Li on 04-07-2010 10:12 AM
0 项奖励
7 条消息(共 11 条)
3,938 次查看

Neil Li wrote:

TRAVO,

 

There is a new feature in Database Connectivity Toolkit in 2010 that can convert that array into specified data type you want directly. You can try it in LabVIEW platform 2010 beta.

Message Edited by Neil Li on 04-07-2010 09:49 AM

Please re-read the beta agreement. You are not allowed to discuss features of LabVIEW 2010 or anything else associated with the beta in a public forum. 

0 项奖励
8 条消息(共 11 条)
3,932 次查看
Sorry about that, I didn't notice that. You can remove my post then if it's possible.
0 项奖励
9 条消息(共 11 条)
3,930 次查看

Sorry for being unclear, basically we have a central server that gets replication from many other servers. I would like to open the connection and keep it open. I think right now it opens connection, runs query,then closes connection. Now, i can use other interface tools (i.e. Toad SQLserver) to run multiple queries, but the amount of data that i am trying to pull and then run analysis on is too much for most applications. I can crunch through 1 years worth of 10min datapoints in about 8 seconds, so it just seems logical to hook the two together to cut out the middle guy. 

 

I also work in a monitoring center, I would like to use the continuous connection and data replication (continuous updating of data) to create a more intelligent monitoring system (big picture and far out of my reach right now ha). I would like to make a data crawler in some sense with triggers. 

0 项奖励
10 条消息(共 11 条)
3,927 次查看