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

    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)
    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)
    Using cmd As New SqlCeCommand()
    cmd.Connection = conn
    cmd.CommandText = query .ToString
    End Using
    Catch sqlExc As SqlCeException
    End Try
    End Sub

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

    Thank you
    ing. ignazio pinto, Nov 6, 2009
    1. Advertisements

  2. ing. ignazio pinto

    ErikEJ Guest

    ErikEJ, Nov 13, 2009
    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.