Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ok Guys or Gals,
I am a controls engineer wearing lots of hats on this project. Jack of all trades... Master of none.

I want to move a csv text string to my sql database. I am trying to determine the best way to move the data considering there are over 120 fields in the record. Of course the sequential data in the csv string corresponds to the fields. Most of the data is 0s, and 1s. I know there are several ways to do this but I thought I would run it by you guys to see if someone knows of the best shortcut.
Posted

In code or using tools?

Personally I'd just use the SQL Import data wizard.
 
Share this answer
 
Comments
TenRC 18-May-10 22:49pm    
Thanks Chris but I guess I need to explain further. I am using a third party dll to trigger and collect inspection results from a vision system. The data comes to me as a csv file generated by the vision system. I currently write the data into a listbox for temporary storage and viewing. My intentions were to then parse the data and then create a query to write the data to the database whenever an inspection occurred. I just thought there was probably an easier way to do this. I write VB code every blue moon or two and am currently trying to get up to speed with both VS and .Net for this project.
Hi there
There are various parsers available on CP. For parsing pure CSV files I use Sebastien Loriens CSV Parser[^]

Otherwise for general Flat File parsing I use Andrew Rissing's Generic Flat File Parser[^]

Happy Coding
 
Share this answer
 
OK... I'm still looking. Can I parse the csv to a structured array and then use a SQL statement to move the contents of the array into a record? I will try to answer this myself but will check back shortly for comments.
 
Share this answer
 
Nevermind.. I finally determined it was easy enough to build my insert statement in the code using a modified version of the csv as a varible.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900