Hello,
I have been working on a automated test system storing data into a SQL server database. Once you get your head wrapped around the toolkit and walk through some of the examples it is not too bad. Writing to the database was very straight forward. I simply put all of my data including the primary keys into a cluster and inserted the cluster into the specified table. As I learned the hard way, it is very important for all of your types to match up. I saved double type from labview as decimal type in the SQL database, and long integer in labview as integer in the SQL database.
For the the read VI, this is where my questions lie. After establishing a connection reference I used the "DB Tools Create Parameterized Query" VI combined with a SQL statement to find the recordset that I was looking for. I used a standard SQL statement using the primary keys such as, "Select * From TableName Where Measurements = "%Measurements%" ". This VI creates a command reference which I then passed to multiple "DB Tools Get Parameter Value" VIs. I could not get this to work with the command reference.
I then switched over to the "DB Tools Execute Query" inputting the same SQL statement I had used before. THis VI passed a recordset reference, which I then passed to a "DB Tools Get Properties" VI to check if the database was empty or not. I then passed the recordset reference to multiple "DB Tools Fetch Element Data" VI's to read the data from the SQL database. THis worked very well.
therefore I am wondering:
What is the difference between a command reference and a recordset reference in the Database connectivity toolkit?
Why would one work and not the other?
Is there ever a case when you would want to use one method over the other?
I have asked my app guys and Labview training instructor different database type questions, and I not received a decent answer to date.
Thanks,
Jackson