Bulk Insert Problem

G

Guest

Attempting to use BULK INSERT to transfer data from a csv to a table in a dbo on an instance of sqlServer (MSDE). I’m very new at both sql server & vb.net. I keep getting an error
Unexpected End-Of-File (EOF) encountered in data fil
The destination table has been created just for this data & I believe I have typed all columns correctly
Does the error’s ‘data file’ refer to the csv or the table
Am I missing some Argument for the BULK statement
See code below. I have tried all arguments that are remarked (without luck)
My conceptual understanding of what is going on here is a bit foggy so as much explanation as you can afford is welcome
Private Sub btnBulk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBulk.Clic
Dim strCommandText As Strin
Dim cmdBlkIn As New System.Data.SqlClient.SqlComman
strCommandText = "BULK INSERT dbDailyEarnings.dbo.[table1a] FROM 'C:\Documents and Settings\Steve\Desktop\Test1a1.csv'
'strCommandText &= "WITH
'strCommandText &= "(
'strCommandText &= "DATAFILETYPE = 'native',
'strCommandText &= "FIELDTERMINATOR = '\c',
'strCommandText &= "ROWTERMINATOR = '\n'
'strCommandText &= "CODEPAGE = 'RAW'
'strCommandText &= ")
cmdBlkIn.CommandType = CommandType.Tex
cmdBlkIn.Connection = connSQ
cmdBlkIn.CommandText = strCommandTex
Tr
connSQL.Open(
cmdBlkIn.ExecuteNonQuery(
connSQL.Close(
Catch ex As Exceptio
Dim strmsg As Strin
strmsg = ex.ToStrin
MessageBox.Show(strmsg
End Tr
_______________________
Thank you to all of you who spend the time to assist the less experience
Steve
 
C

Cor

Hi Steve,

This is really a question for the newsgroup

news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet

Although this was an answer on a almost the same question yesterday in this
newsgroup fom Bill Vaughn. (But not so detailed as yours, so you can give it
a try).

Do not use ADO.NET for bulk operations--it's not designed to do this.
Use BCP or DTS--it IS designed to move bulk data into and out of databases.

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top