LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bulk Inserting Data using SqlBulkCopy class - Constructor on type System.Data.DataColumn not found

Solved!
Go to solution

I am trying to use methods from the SQLBulkCopy class to do bulk inserts of data into a PostgreSQL RDBMS. Think "array of clusters." I'm basically buffering a bunch of data to be inserted when a task is completed, rather than constantly doing transactional inserts that have much more overhead.

 

To do this, I'm using the SqlBulkCopy(DataTable table) method as the IDataReader and DataRow objects don't have public constructors in LabVIEW. Here's my current implementation:

 

But that fails with this error:

 

 

The VI is attached for reference. Any ideas (or bulk insert alternatives) would be appreciated.

0 Kudos
Message 1 of 6
(3,788 Views)

Instead of using Typecast, use "To More Specific Class". Does that work better?

0 Kudos
Message 2 of 6
(3,767 Views)

Now I get "Type mismatch. Object cannot be cast to the specified type". I believe this is because the double constant isn't really a "datatype", which is what needs to be wired. I found an article detailing which .NET datatypes correspond to which LV datatypes, but I don't know how to make a datatype constant for .NET in LV. Ideas?

0 Kudos
Message 3 of 6
(3,764 Views)

Ok you don't need any changing clas or typecast - try using an Invoke Node with "GetType()" and wire that to the dataType input.

0 Kudos
Message 4 of 6
(3,761 Views)
Solution
Accepted by topic author ijustlovemath

SQL Insert System Type.png

Message 5 of 6
(3,759 Views)

Excellent! I got it to work using that:

 

 

It shows that I should probably get more familiar with the basic class methods and properties before going on any further eh? Thanks!

0 Kudos
Message 6 of 6
(3,756 Views)