SQL Server
(1)
DatToTableCE
(1)
SqlCeResultSetas
(1)
SqlCeResultSet
(1)
SqlCeCommand
(1)
StringBuilder
(1)
Ejlskov
(1)
DbTable
(1)

Bulk Insert and SQL CE?

Asked By ing. ignazio pinto
06-Nov-09 07:28 AM
Hi, to all
I have this question for you:
it is possible to use BULK INSERT T-SQL Statement with SQL Server Compact
Edition?

I try as follow:


Private Sub DatToTableCE(ByVal conStr As String, ByVal dbTable As String,
ByVal dat As String, ByVal xml As String)
Try
Dim query As New StringBuilder
query .Append("BULK INSERT ")
query .Append(dbTable)
query .Append(" FROM '" & dat & "'")
query .Append(" WITH (FORMATFILE = '" & xml & "')")
Dim conn As New SqlCeConnection(conStr)
conn.Open()
Using cmd As New SqlCeCommand()
cmd.Connection = conn
cmd.CommandText = query .ToString
cmd.ExecuteNonQuery()
End Using
Catch sqlExc As SqlCeException
MsgBox(sqlExc.toString)
End Try
End Sub

but this code return me a sqlCeException.
Have you any suggests?

Thank you
--

The fastest way to insert data via managed code is to use the SqlCeResultSetas

ErikEJ replied to ing. ignazio pinto
13-Nov-09 04:45 AM
The fastest way to insert data via managed code is to use the SqlCeResultSet
as show here:
http://windowsmobiledn.com/sql-compact-edition-insert-performance/
and in the source of this project: http://sqlcebulkcopy.codeplex.com
--
Erik Ejlskov Jensen - MCTS: Mobile App Dev
Post Question To EggHeadCafe