asp.net - filtering data from a csv file and storing it in a mysql database using vb.net -


i new intern , new .net , have been given task of filtering data csv file , save microsoft sql server susing vb.net,so far haven't seen straightforward answer,anyone can help?...,thanks in advance

you can import csv sql-server directly via bulk insert.

if need/want use .net can use csv-reader this read csv-file. can use sqlbulkcopy import database efficiently.

here article it:

http://www.codeproject.com/articles/439843/handling-bulk-data-insert-from-csv-to-sql-server

vb.net:

using conn = new sqlconnection(connectionstring)     conn.open()     dim transaction sqltransaction = conn.begintransaction()     try         using file new streamreader(filename)             dim csv new csvreader(file, true, "|"c) ' change separator '             dim copy new sqlbulkcopy(conn, sqlbulkcopyoptions.keepidentity, transaction)             copy.destinationtablename = tablename             copy.writetoserver(csv)             transaction.commit()         end using     catch ex exception         transaction.rollback()     end try end using ' closes connection ' 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -