Importing Excel to SQL Server CE -


I have a table in Excel format (2007, but I can naturally save anything below), and my Server with Component SQL related packages Compact version 3.5 SP1 Database table I want to populate SQLCE table with data from Excel file. Data consists of strings and integers.

I did not attempt any profit, I also tried it, but it will not work because bulk INSERT is not supported in SQL Server CE.

Edit: I came, but I also came to know, but basically I do not know when it comes to SQL, Provider and ...

Edit: The following code (through)

  var filename = string. Format ("{0} \\ DataValues.xls", Directory.GetCurrentDirectory ()); Var connectionString = string.Format ("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = {0}; Extended Properties = Excel 8.0;", Filename); Var Adapter = New Audiadetta Adapter ("SELECT * FROM [Sheet1 $]", connectionString); Var ds = new dataset (); Adapter Filled (DS, "Any Name"); DataTable DataTable = DTTables ["Any Name"]; Forward (DataRate. DatataRow line in RAO) _entities.MyObjectSet.AddObject (New MyObject () {Foo = (string) line [1], bar = convert. ToInt32 (line [2]),}); _entities.SaveChanges ();  

But SaveChanges () crashes with "server-generated keys and values ​​created by the server are not supported by SQL Server Compact". I tried changing all ID types to GUID (= Unique Identifier), but I still get the message

EDIT2: I changed the StoreGeneratedPattern property to "None" and Now it works. An interesting point to note is that the .sdf file is copied to the runtime directory, and that copy is changed, so that you Changes will not be visible . SDF is linked to your project - you have to manually copy it

My question still remains - is there a SQL Server CE equivalent to the following?

  Bulk with your DNT tab 'D: \ YourFile.csv' (FIELDTERMINATOR = ',', ROWTERMINATOR = '\ n') GO  

Or even better - such as Microsoft's SQL Server Import and Export Wizard which can be exported to SQL Server CE?

I EF (at least for this).

You have not posted your database schema, but take a look and take a look.

However, you must un-mark it as the server has been assigned and assign it when the object is created.


Comments