Hi Everyone,

I am using the app.config because I have to deal with different databases.
I absolutely cannot generate a table in a memory database.
If it's a real one it works properly.


my app.config:

<system.data>
  <DbProviderFactories>
    <add name="SQLite Data Provider" invariant="System.Data.SQLite"
         description=".Net Framework Data Provider for SQLite"
         type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
  </DbProviderFactories>
</system.data>
<connectionStrings>
  <!--<add name="Storage"
       connectionString="Data Source = .\System\Storage_g.db;foreign keys=true;"
       providerName="System.Data.SQLite" />-->
  <add name="Storage"
       connectionString="Data Source =:memory:; foreign keys=true;"
       providerName="System.Data.SQLite" />
</connectionStrings>

with the Code:

DatabaseProviderFactory factory = new DatabaseProviderFactory();
this.database = factory.Create("Storage");
DbConnection cn = this.database.CreateConnection();
cn.Open();
DbCommand cmd = this.database.GetSqlStringCommand("CREATE  TABLE Tab_1(Key 
INTEGER, Value INTEGER)");
this.database.ExecuteNonQuery(cmd);
// this should generate error "Tab_1 already exists"
// but in memory it does not !!!!
this.database.ExecuteNonQuery(cmd);


Can anyone help me with this problem?

Thanks all;


Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to