Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Tab Delimited To MsSql

Posted on 2007-07-26
1
Medium Priority
?
381 Views
Last Modified: 2008-03-10
I have a tab delimited file that I need to  import into SQL via VB.  It will be generally 10-12 thousand records.  I have been reading about sqlbulkcopy but have not found any good code examples.  Can any suggest methods to import a large file like this efficiently as well as provide coding examples?
0
Comment
Question by:K3HT
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 19577241
Here is the SqlBulkCopy example:

Imports System
Imports System.Data
Imports System.Data.SqlClient

Public Class BulkInsert

  Public Shared Sub InsertDataTable(ByVal connectionString As String, ByVal table As DataTable)
    Dim copier As New SqlBulkCopy(connectionString)
    copier.DestinationTableName = table.TableName
    copier.WriteToServer(table)
  End Sub

End Class

Bob
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question