working with sqlce and ErikEJ.SqlCe library

2.1k views Asked by At

i got this errors

Error 1 The type 'System.Data.SqlServerCe.SqlCeTransaction' is defined in an assembly is not referenced That. You Must add a reference to assembly 'System.Data.SqlServerCe, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = 89845dcd8080cc91'.

WHERE DO I DOWNLOAD VERSION 4.0.0.0? I didn't find it.

Error   2   The type 'System.Data.SqlServerCe.SqlCeConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'.

same problem..

Error 3 The best overloaded method match for 'ErikEJ.SqlCe.SqlCeBulkCopy.WriteToServer (System.Data.DataTable)' Some invalid arguments have

overloaded? only i want to use it :s

Error   88  The best overloaded method match for 'ErikEJ.SqlCe.SqlCeBulkCopy.WriteToServer(System.Data.DataTable)' has some invalid arguments   

?? it DOES allow datatable . i dont understand it..

Error   94  Argument '1': cannot convert from 'System.Data.DataTable [c:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Data.dll]' to 'System.Data.DataTable []'

convert to datatable[]?? what?

well this is my method code.

private void DoBulkCopy(bool keepNulls, System.Data.DataTable tabla, string nombretabla) { if (tabla.Rows.Count > 0) {

        ErikEJ.SqlCe.SqlCeBulkCopyOptions options = new ErikEJ.SqlCe.SqlCeBulkCopyOptions();
        if (keepNulls)
        {
            options = options |= ErikEJ.SqlCe.SqlCeBulkCopyOptions.KeepNulls;
        }
        //using (SqlCeBulkCopy bc = new SqlCeBulkCopy(connectionString, options))

        using (SqlCeBulkCopy bc = new SqlCeBulkCopy(Resco.Data.Database.Instance.ConnectionString,options))
        {

            bc.DestinationTableName = nombretabla;

            try
            {
                bc.WriteToServer(tabla);
            }
            catch(Exception ex) { }
        }
        }

}
1

There are 1 answers

1
vesi On

Easy way -> install to project using Package Manager Console.

PM> Install-Package ErikEJ.SqlCeBulkCopy

See http://nuget.org/packages/ErikEJ.SqlCeBulkCopy