07-17-2016 11:14 AM
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.
Solved! Go to Solution.
07-17-2016 08:20 PM
Instead of using Typecast, use "To More Specific Class". Does that work better?
07-17-2016 08:28 PM
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?
07-17-2016 08:43 PM
Ok you don't need any changing clas or typecast - try using an Invoke Node with "GetType()" and wire that to the dataType input.
07-17-2016 08:45 PM
07-17-2016 08:51 PM
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!