1

我收到了这个错误

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'.

我在哪里下载版本 4.0.0.0?我没找到。

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'.

同样的问题..

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

超载?只有我想用它:s

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

?? 它确实允许数据表。我不明白。。

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 []'

转换为数据表 []?? 什么?

好吧,这是我的方法代码。

私人无效DoBulkCopy(bool keepNulls,System.Data.DataTable tabla,字符串nombretabla){如果(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) { }
        }
        }

}
4

1 回答 1

0

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

PM> Install-Package ErikEJ.SqlCeBulkCopy

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

于 2013-01-14T08:57:58.667 回答