views:

363

answers:

2

Hi, I got it right to create a SQL Server CE database table using the code below:

string connectionString = "DataSource=\"test.sdf\"; Password=\"mypassword\"";
SqlCeEngine en = new SqlCeEngine(connectionString);
en.CreateDatabase();

But how do I create my database tables and insert data? I've got the SQL created statements stored in the application Resource location.

A: 

It should be as easy as loading the SQL statements and executing them.

If you don't know how to load resources, or execute the SQL statements, update your question and indicate which language you're using, so we can give you code examples.

EDIT: Nevermind, I see you're using C#...

SqlCeConnection conn = new SqlCeConnection(en.LocalConnectionString);
SqlCeCommand cmd = new SqlCeCommand(sql, conn);
cmd.ExecuteNonQuery();
overslacked
A: 

How about reading this blog article?

ctacke