Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Bulk Insert Help

Bulk Insert Help

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    superwinsock
    wrote on last edited by
    #1

    Hey Guys I am trying to Bulk Insert a Text file into an SQL DB through VB6. I have never used this Object Model before so any help would be appreciated. I have this code from MSDN but cant seem to implement it?? ----------------------------- 'initialize Payroll table in DTS_UE db with bulk data Dim objPackage As DTS.Package2 Dim objConnect As DTS.Connection2 Dim objStep As DTS.Step Dim objTask As DTS.Task Dim objBulkCopy As DTS.BulkInsertTask On Error GoTo Handler Set objPackage = New DTS.Package 'create database connection Set objConnect = objPackage.Connections.New("SQLOLEDB.1") With objConnect .ID = 1 .DataSource = "(Local)" .UseTrustedConnection = True End With objPackage.Connections.Add objConnect 'create step and task, specify data file and format Set objStep = objPackage.Steps.New Set objTask = objPackage.Tasks.New("DTSBulkInsertTask") Set objBulkCopy = objTask.CustomTask With objBulkCopy .Name = "BulkInsTask" .DataFile = "C:\Development\Bulk Insert\TEST.txt" .ConnectionID = 1 .DestinationTableName = "BULK_INSERT_TEST..BI_Test" .FieldTerminator = "-t" .RowTerminator = "\n" End With 'link step to task to package, run package objStep.TaskName = objBulkCopy.Name objStep.Name = "BulkInsStep" With objPackage .Steps.Add objStep .Tasks.Add objTask .FailOnError = True .Execute End With

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups