Question

I know this question was asked before but I have a little different requirement.

I need to copy data from SQL Server to a local application SQL Server CE file.

I got the table data from main server into a datatable, but I'm not able to efficiently copy that to SQL Server CE table.

I tried an adapter.update() but it takes a lot of time if number of rows are large (took around 3 min for 25k rows)

Inserted each datarow by calling insert command every time (highly inefficient and probably same as what adapter.update is doing)

I tried storing the values into a string and writing an insert command with that string so that I can insert 1000 rows each time I run the command. But it gives an error during parsing at the token ',' near second row value.

Exact error :

There was an error parsing the query. [ Token line number = 1,Token line offset = 40,Token in error = , ]

I tried SqlCeBulkCopy by erikej, it gives me an error sqlserverce.dll reference not found, I double checked I had the reference added and I have SQL Server CE 3.5 sp1 installed on the device.

Exact error :

Could not load file or assembly 'System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=3be235df1c8d2ad3, Retargetable=Yes' or one of its dependencies

Any directions on how I should proceed?

Was it helpful?

Solution

You can use SqlCeBulkCopy provided the 3.5 SP2 cab files are properly installed on the device.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top