ni.com is currently undergoing scheduled maintenance.

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

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Text & MS Access (David)

Hello, David,

Since you were able to answer so many DBT questions really well, I hope you can help with mine.

I have this file in notepad and I want to insert the data into MS Access db.  DO you know how to do that ?

Thanks.

(Anyone else is welcome to answer.)

Here's the attachment:

0 Kudos
Message 1 of 9
(3,766 Views)
Do you already have an Access database table with four fields aka columns?
And does each row of the text file correspond to one row in the Access database table?
 
If so, then it is a matter of reading each line from your text file, parsing out the "values"
that is to go into each column and write an SQL statement to insert those values into the
Access database table.
Message 2 of 9
(3,742 Views)
Can you show an example of what you are suggesting.
Thanks.
0 Kudos
Message 3 of 9
(3,732 Views)

Try looking at some of the articles here.

http://zone.ni.com/devzone/devzone.nsf/webcategories/4161F118BF99CCE686256AB7006A68EB

It isn't a trivial task unfortunately. NI sells a database connectivity tool.

Message 4 of 9
(3,722 Views)

Yes, I have the DBT.  Do you have any examples using it.

Thanks.

0 Kudos
Message 5 of 9
(3,722 Views)

I didn't use the Database Connectivity Toolkit.

I basically took some of the example VIs that were on the NI website at the time, read the Help files that came with Microsoft Office which were geared towards Visual Basic, and read chapters in the book ADO for Dummies. From there just trial and error.

You need to have some fundamental understanding of SQL. Nothing indepth though.

Unfortunately, I am not sure where the VIs I wrote are now. 😞

you might want to read this too http://digital.ni.com/public.nsf/websearch/F763AA1D7CD3C83D862568E8007C51CD?OpenDocument

Message Edited by nyc on 02-07-2006 01:52 PM

Message 6 of 9
(3,716 Views)

OK just found you didn't spot you until you gave me a nudge.

As I said before I am pretty rusty with the DBT but if I was doing this I would

1. Read in the text file using the file functions.

2. The string can then be converted into a spreadsheet array.

3. You will then use a for loop to autoindex out the rows, convert them to numberics and insert into the database as you go.

In the meantime show me what you have done so far and mention the problems that you have been having.

And I will try and catch up with you tomorrow if I get time.

David

Message 7 of 9
(3,701 Views)
Here it is!
 
I get long binary data in Access when I open the db.
 
When I looked at the data type it was "OLE object."
By the way I have tried changing it into numbers and double and single in the field, but it does nothing but give error.
This is continuous issue because it keeps poping up.
 
Thanks:)!

Message Edited by roboticstudent on 02-08-2006 12:02 PM

Message Edited by roboticstudent on 02-08-2006 12:03 PM

Download All
Message 8 of 9
(3,697 Views)
R
 
Have a look at the examples shipped by NI with the Toolkit. So thats Help->Find Examples->Toolkits and Modules->Database Connectivity and open the Logging Example.
 
This is almost what you need so take a copy of this so that you are not editng the original Logging Example.vi. This example uses LabVIEW.mdb and Labview.udl and they are found in ...\Labview 8.0\examples\database directory.
 
I would change the while..loop to a for..loop. You already know how to read the text file and get the data into an 2D array of DBLS. You will then use this for loop to auto index out each row of your data. Each row of your data is an 1D array so you can either decide to insert this into one field as an OLE object or index out the scalars into seperate numeric fields. Fields are the columns of your table that is create automatically by the Logging Example.vi. So potentially the Logging table will have a table of 172 rows and 5 columns of data based on your datafile.
 
Hope this helps
 
David
 
 
Message 9 of 9
(3,670 Views)