[dba-VB] Moving aText file into SQL 2005 Express

Gustav Brock Gustav at cactus.dk
Tue Apr 22 05:57:51 CDT 2008


Hi John

For #3 I would use a DataTableAdapter to attach the table of the database - and then feed your data to a DataTable of the DataTableAdapter.

/gustav

>>> Johncliviger at aol.com 22-04-2008 11:40 >>>
Hi All
 
As part of my teach yourself vb.net 2005/08 project I'm trying to import a  
.txt file(with white space between columns)  into an Array, clean it up and  
dump it into a SQL express table all nicely cut up with the appropiate  
datatypes. So far I've got my vb project to read the file contents into an  ArrayList 
and using Console.Writeline() I get a pretty display of data in  columns in 
the output window. 
 
I'm now geting an attack of self doubt that my approach is correct. 
 
Heres my thinking.  
1) Build a Class to read a xxxxx.txt file into an  Array (1D  array)  using 
MS.VB.FileIO.TextFieldParser(file path and name). 
2) Then loop thru the Array cutting up the string using String.Split  and 
assigning a datatype as we go thru the loop. 
3) Dump each new field into a Dataset. Run and Append query to  populate the 
SQL table.
 
I'd be grateful for any comments as to my modus operandi.
 
Regards
johnc






More information about the dba-VB mailing list