08-10-2005 08:29 AM
Thanks, I will try to alter the tables on the fly if needed using the sql commands provided. I think this should solve the problem at hand.
Paul
08-10-2005 08:56 AM
This sort of highlights the issue I was speaking to earlier, talking to a database is easy. The challenging (and interesting) part is working with them. The first thing is to be sure that you have a good database design to work with. In a properly designed, well-normalized database design you should have to rarely modify the database structure.
The important thing to remember is that the database design should model the structure of your data--NOT the way you acquire or want to display the data. For example, if you are needing to change your database structure because you were collecting three pieces of data and now you are going to be collecting four--that's a bad database design. We like to look at data in tables like spreadsheets. Unfortunately, that's exactly the wrong structure for a database.
There are a bunch of good books on this topic, one of my favorite is The Practical SQL Handbook by Bowman, Emerson and Darnovsky.
Mike...
08-10-2005 09:00 AM
By the way: Item 2 may appear convenient, but in practice it is a really bad way of designing LV code that accesses a database. It's bad because it intimately ties you code into the structure of a particular database table. As a result, if the datatable changes your code has to as well.
Mike...
08-11-2005 07:20 AM
08-11-2005 10:44 AM
Hi, everyone
I've been following this thread very closely and decided it was my turn to jump in and add my comments. You can think of the Database Toolkit as a set of different tools for different levels of users much like how the file I/O functions are organized. The top-level database VIs that use clusters to transfer the data are similar to the top-level file I/O functions in that they do very simple things quickly and hide the details from you. However, if you've used file I/O enough, you quickly realize that if you want custom formats or more power over how your files are written or read, you need to get rid of the high-level subVIs and start using the things in the file I/O:Advanced palette.
08-11-2005 09:44 PM
Paul;
I started writing a reply earlier this evening, but then I realized that given the importance of this issue, I wanted to take some time and write a reply that has some deeper thought involved in it than what you would get from a quick reply. I'll post an answer tomorrow night that will (hopefully) be worth the wait.
08-12-2005 02:55 AM
Hi,
In my opinion the best way to keep your database structure apart from your LabVIEW code is with Stored Procedures (Microsoft SQL Server) or Functions (Oracle). The Stored Procedures (SP's) allow you to define input parameters and SQL code to specify what to do with the input parameters.
Now you need to mind 3 things.
1. Keep your cluster in LabVIEW consistant with the Stored Procedure inputs. (Or use a tool like T&M Datab...... that checks and corrects the consistancy)
2. Use the SQL Wizard to automaticaly create Stored Procedures for your tables (select, insert, update, delete)
3. Freely add columns to your table, only if you change column specification you have to check your SP's
I hope this can help you,
-See you (possibly) at NIWEEK!
With kind regards,
Arnoud de Kuijper
T&M solutions BV
08-12-2005 04:48 AM
08-14-2005 11:02 PM
Paul;
Here's the writeup I promised you last week took a bit longer than I envisioned, but it's also longer than I thought it was going to be. In any case hope this helps...
Mike...
08-15-2005 07:29 AM
Last night when I was doing the final edits on this document I had a brain lapse. The reference in the bibliograpy to books by Randy Johnson, should of course be books by GARY Johnson.
Many apologies Gary...