jayplus707
Programmer
How do you initialize a database? I know you can create it and the tables by executing various SQL statements, such as:
SqlCeEngine engine = new SqlCeEngine ("Data Source = " + strPath);
engine.CreateDatabase ();
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "CREATE TABLE TestTbl(id int PRIMARY KEY, name ntext, URL nText, userID nText, password nText, notes nText)";
cmd.ExecuteNonQuery();
But I'm trying to create a database by first creating a dataset and then "updating" the empty database that I am connecting to. Is this possible? What are the pros and cons of doing this? Is it better to stick with SQL?
SqlCeEngine engine = new SqlCeEngine ("Data Source = " + strPath);
engine.CreateDatabase ();
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "CREATE TABLE TestTbl(id int PRIMARY KEY, name ntext, URL nText, userID nText, password nText, notes nText)";
cmd.ExecuteNonQuery();
But I'm trying to create a database by first creating a dataset and then "updating" the empty database that I am connecting to. Is this possible? What are the pros and cons of doing this? Is it better to stick with SQL?