I create a database file using the following method.
public bool CreateDatabaseFile() { try { Stream file = File.Create(DBPath); file.Close(); return true; } catch (Exception) { return false; } }
But when I call
public void CreateDatabaseStruct() { var queries = new List<string> { "create table contacts (\"name\" nvarchar,\"emails\" nvarchar);", "create table errors (\"code\" int, message nvarchar);" }; foreach (string query in queries) { var con = new SqlCeConnection(connectionString); con.Open(); var cmd = con.CreateCommand(); cmd.CommandText = query; cmd.ExecuteNonQuery(); con.Close(); } }
he returns
The specified locale is not supported on this operating system [LCD - 1].
How to fix it?
UPDATE
Connection string:
public static readonly string DBPath = "db.sdf"; public static readonly string connectionString = String.Format("Data Source={0}; Password=...", DBPath);
source share