Compartilhar via


SqlCeEngine.CreateDatabase Method

Creates a new database.

Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)

Syntax

'Declaration
Public Sub CreateDatabase
'Usage
Dim instance As SqlCeEngine

instance.CreateDatabase
public void CreateDatabase ()
public:
void CreateDatabase ()
public void CreateDatabase ()
public function CreateDatabase ()
Not applicable.

Example

The following sample demonstrates how to create a new SQL Server Compact Edition database.

File.Delete("Test.sdf")

Dim connString As String = "Data Source='Test.sdf'; LCID=1033; Password=""s$;2'!dS64""; Encrypt = TRUE;"
Dim engine As New SqlCeEngine(connString)
engine.CreateDatabase()
File.Delete("Test.sdf");

string connString = "Data Source='Test.sdf'; LCID=1033; Password=\"s$;2'!dS64\"; Encrypt = TRUE;";
SqlCeEngine engine = new SqlCeEngine(connString);
engine.CreateDatabase();

Platforms

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

.NET Compact Framework

Supported in: 2.0, 1.0

See Also

Reference

SqlCeEngine Class
SqlCeEngine Members
System.Data.SqlServerCe Namespace