Hi,
has someone a short code example how to create an sdf.-database and table
with the classes of the SqlServerCe-Namespace.
Thanks
Stefan

Re: create table by Patrick

Patrick
Tue Feb 27 15:05:28 CST 2007

Stefan,

You'll find everything explained here :

http://samples.gotdotnet.com/quickstart/CompactFramework/doc/sqlcedbcreate.=
aspx

--
Patrick Avenel

On 27 f=E9v, 21:10, Stefan Dietl <i...@sdsoft.it> wrote:
> Hi,
> has someone a short code example how to create an sdf.-database and table
> with the classes of the SqlServerCe-Namespace.
> Thanks
> Stefan



Re: create table by Ginny

Ginny
Tue Feb 27 15:15:36 CST 2007

Stefan,

Here's a short sample. You'd need to add error handling for production:

string sdfFile = "YourFile.sdf"; // this will be in root folder of device
since no path provided
SqlCeConnection conn;

if(File.Exists(sdfFile)
{
conn = new SqlCeConnection("Data Source="+sdfFile);
conn.Open();
}
else
{
// create database
SqlCeEngine engine = new SqlCeEngine("Data Source="+sdfFile);
engine.CreateDatabase();

conn = new SqlCeConnection("Data Source="+sdfFile);
conn.Open();

// create a table in the database
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "Create table YourTable "+
"(SomeString nvarchar(50) not null, "+
" SomeOtherString nvarchar(50) not null, "+
" SomeInt int not null)";
cmd.ExecuteNonQuery();
}
// now your database is created, opened and has one table

conn.Close();

--
Ginny


"Stefan Dietl" <info@sdsoft.it> wrote in message
news:qmnwffu2uzsd$.1m587uh2aliop.dlg@40tude.net...
> Hi,
> has someone a short code example how to create an sdf.-database and table
> with the classes of the SqlServerCe-Namespace.
> Thanks
> Stefan


Re: create table by Stefan

Stefan
Wed Feb 28 03:11:41 CST 2007

Patrick,

> http://samples.gotdotnet.com/quickstart/CompactFramework/doc/sqlcedbcreate.aspx

Thank You for the interesting link!
Stefan

Re: create table by Stefan

Stefan
Wed Feb 28 03:20:57 CST 2007

Thank You Ginny for helping me on my first steps form VO to .net.
Programming the mobile devices is forcing me to do that. Are You just using
Vulcan with success?
Stefan

Re: create table by Ginny

Ginny
Wed Feb 28 06:02:02 CST 2007

Hi Stefan,

I'm still in the testing phase with Vulcan and am using C# for .NET apps. I
plan to use Vulcan for legacy VO code though when it is ready.

--
Ginny


"Stefan Dietl" <info@sdsoft.it> wrote in message
news:1li7w8qk93wrn.1cdq92gu6yqvi$.dlg@40tude.net...
> Thank You Ginny for helping me on my first steps form VO to .net.
> Programming the mobile devices is forcing me to do that. Are You just
> using
> Vulcan with success?
> Stefan