Is there any way to use Bulkcopy in a VB program to import either a fixed-length or CSV file into a SQL table? The following code will import a text file into an Access table but unfortunately the SQLOLEDB provider doesn't have the same text functionality as the Jet provider.
Someone suggested using Bulkcopy but I've been unable to make a start on it. The C example in the SQL Server 7.0 Books Online didn't help.
Code:
strRetConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path & "\Test_Returns.mdb;Persist Security Info=False"
Set cnReturns = New ADODB.Connection
cnReturns.Open strRetConn
cnReturns.Execute "INSERT INTO returns SELECT * FROM " & _
"[Text;HDR=NO;FMT=Delimited;Database=C:\]." & _
"[WorkFile.txt]"
cnReturns.Close: Set cnReturns = Nothing