11-20-2011 11:28 AM
Hi,
I have sql server and sql database. I use connectivity toolkit and DB tools, to open, write...on this database...
I want to know where can I set that will store my data only on change ? Any hint, advice?
thanks
Solved! Go to Solution.
11-20-2011 12:45 PM
Anyone?
11-21-2011 04:30 AM
Dear hlod,
I'm affraid, there is not a simple database VI, which implicitly checks your data, and update in database if changed, however you can do a it programmatically.
To achive the described functionality, you can use value polling with while loops, or event structures registred to user defined events, and in the code area you can put your database update VIs.
If you use LabVIEW DSC module as well, you can subscribe to shared variable value change events and provide your database update code in an event structure.
I found some useful example for you:
Log Value Changes of All Front Panel Controls to a File or Database
If you use DSC module, you can take a look on this example VI from the Example Finder:
If you're looking for something else for your application, please provide more specific information about it.
Best Regards,
Tamas Szekely
Applications Engineer
National Instruments
11-21-2011 07:48 AM
The notification of database changes is dependent on the database you use, the version you use, and the specific provider you use. With SQL Server 2008 you could add triggers to tables, as discussed here: http://msdn.microsoft.com/en-us/library/bb726006.aspx. There is also the SqlDependency class (.NET).
Your question is really more of a database question rather than a LabVIEW question, so perhaps you will gain more traction by posting in one of the SQL forums, or by doing a search on stackoverflow.com.
Also, please be aware that you posted your message on a Sunday. This forum is primarily made up of volunteers. A little patience is appreciated.
11-21-2011 12:24 PM
Hmm, unfortunately I have SQL Server 2005; I received data via OPC client-> MS SQL server(database). I just want that from OPC server will logged into database just on change.
11-25-2011 03:25 AM
Dear hlod,
I have some questions:
Do you wan't to get notification if change accoured at OPC server or in the SQL server?
Are you looking for a solution, how to program that in LabVIEW, or you are looking for if there is an option to configure OPC server for logging on data value change?
Best Regards,
Tamas Szekely
11-25-2011 04:07 AM
If you're using LV to view/edit the database as indicators/controls/tables you can use ValueChange events which only fire when an item is changed to perform an update query. If you want to follow/trigger if someone else change something in the database it wont work though, but if you only want to update the database when you change a value it can work.
/Y
11-25-2011 05:43 AM
Thanks to all, I use "shift register" and I think it's working...(i was only need to write in DB when appears change in input data..)
thanks