December 18, 2014 at 3:06 pm
I used code below to copy datatable (dt) to a table (999CA) in SQL server but failed without error.
If I change table's name from "999CA" to "T999CA" it is OK.
Is it bug?
Using bulkCopy As SqlBulkCopy = _
New SqlBulkCopy(cn)
bulkCopy.DestinationTableName = "999CA"
Try
' Write from the source to the destination.
bulkCopy.WriteToServer(dt)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Using
December 18, 2014 at 3:30 pm
A table name cannot start with a number
December 19, 2014 at 9:58 am
Hi adonetok ,
I would suggest you to have a look at
http://msdn.microsoft.com/en-us/library/System.Data.SqlClient.SqlBulkCopy(v=vs.110).aspx where there is an example of code for the SqlBulkCopy class. I prefer to put a catch related to the SqlException because the Message property is clearer.
Have a nice day
December 21, 2014 at 10:51 am
The post of Robert Klimes should be marked as the good answer by the original poster.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply