SqlCeEngine.CreateDatabase 方法

创建新数据库。

命名空间:  System.Data.SqlServerCe
程序集:  System.Data.SqlServerCe(在 System.Data.SqlServerCe.dll 中)

语法

声明
<SecurityCriticalAttribute> _
<SecurityTreatAsSafeAttribute> _
<SecurityPermissionAttribute(SecurityAction.Assert, UnmanagedCode := True)> _
Public Sub CreateDatabase
用法
Dim instance As SqlCeEngine

instance.CreateDatabase()
[SecurityCriticalAttribute]
[SecurityTreatAsSafeAttribute]
[SecurityPermissionAttribute(SecurityAction.Assert, UnmanagedCode = true)]
public void CreateDatabase()
[SecurityCriticalAttribute]
[SecurityTreatAsSafeAttribute]
[SecurityPermissionAttribute(SecurityAction::Assert, UnmanagedCode = true)]
public:
void CreateDatabase()
[<SecurityCriticalAttribute>]
[<SecurityTreatAsSafeAttribute>]
[<SecurityPermissionAttribute(SecurityAction.Assert, UnmanagedCode = true)>]
member CreateDatabase : unit -> unit 
public function CreateDatabase()

示例

下面的示例说明如何创建一个新的 SQL Server Compact 数据库。

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();

请参阅

参考

SqlCeEngine 类

System.Data.SqlServerCe 命名空间