From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with writing data to the table in SQL server express 2012 database using labview

None of that makes any sense. The wait is not required, nor the while loop. If it works at all, it would just keep writing the same data over and over again. What is the actual data type in the cluster? I suspect you need a for loop to write each row.
0 Kudos
Message 11 of 17
(631 Views)

If you are planning to write a lot of data and really fast into SQL table, You should make the VI in 2 steps. 

Step 1: Write the data to a text file

Step 2: Read from text file and write to the SQL table. 

 

The reason being that you cannot write really fast and lot of points from labview to SQL. You will loose half of the points in the process. 

 

When you write to the text file, its way faster and you have all the data secured. Then you can run the other part and it might take like 5 mins approximetly (depending on the number of points you are reading) to send the data to SQL. 

 

 

0 Kudos
Message 12 of 17
(626 Views)

I have attached an example for reading from text file to SQL. Maybe that helps

0 Kudos
Message 13 of 17
(624 Views)
I've been using the database toolkit since before it was owned by NI and have never lost data or had to resort to writing to a file.
0 Kudos
Message 14 of 17
(616 Views)

 


@Dennis_Knutson wrote:
None of that makes any sense. The wait is not required, nor the while loop. If it works at all, it would just keep writing the same data over and over again. What is the actual data type in the cluster? I suspect you need a for loop to write each row.

The actual data type is DBL, it's just acceleration in g. I had the wait and the while loop in there from the example on continuous logging, but I had suscpicions it wasn't really necessary. 

0 Kudos
Message 15 of 17
(597 Views)

@manny09 wrote:

I have attached an example for reading from text file to SQL. Maybe that helps


Let me just make sure I understand your VI... You write to a text file, and then call that file name into the loop that connects to your SQL server and insert it into a table? That would work... I'll give it a shot!

0 Kudos
Message 16 of 17
(595 Views)

First off, you only have to create the table once -- ever. While you can do that in LV, you will hardly ever want to.


Second, the DCT will make life infinitely more difficult for you. The process for inserting data into a database is really very easy and the DCT does an excellent job of hiding that simplicity beneath a complex, proprietary interface.

Check out this thread for most of what you need to know to use databases easily -- including some free drivers.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 17 of 17
(590 Views)