Bulk Insert and SQL CE?

Discussion in 'microsoft.public.sqlserver.ce' started by ing. ignazio pinto, Nov 6, 2009.

  1. Hi, to all
    I have this question for you:
    It's possible to use BULK INSERT T-SQL Statement with SQL Server Compact
    Edition?

    I try as follow:

    <param name="conStr">Connection string</param>
    <param name="dbTable">MyTable name</param>
    <param name="dat">path file: MyTable .dat </param>
    <param name="xml">path file: MyTable .xml </param>

    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
    --
     
    ing. ignazio pinto, Nov 6, 2009
    #1
    1. Advertisements

  2. ing. ignazio pinto

    ErikEJ Guest

    ErikEJ, Nov 13, 2009
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.