By trying I found out that SQLiteConnection("Data 
Source=:memory:;cache=shared"); worked.
In a single aspx.page at cs code, first I open an in-memory database connection 

        SQLiteConnection conn = new SQLiteConnection ( "Data 
Source=:memory:;cache=shared" );
        conn.Open();

than create table and insert some data
then without closing that connection open another connection in the sameway, 
but when I try to select the rows of the table that I created in the previous 
table, I get no such table error.
What am I doing wrong???

 
________________________________
 From: Pavel Ivanov <paiva...@gmail.com>
To: T Ü <shocking_blue2...@yahoo.com>; General Discussion of SQLite Database 
<sqlite-users@sqlite.org> 
Sent: Thursday, July 5, 2012 3:21 PM
Subject: Re: [sqlite] Multiple connections to in-memory database
 
On Thu, Jul 5, 2012 at 7:46 AM, T Ü <shocking_blue2...@yahoo.com> wrote:
> I have an asp.net application.
> I open a sqlite in-memory connection with SQLiteConnection conn = new 
> SQLiteConnection ( "Data Source=:memory:" ); command.
> I read that by using cache=shared parameter, I can make that in-memory 
> database reachable from other connections.
>
> 1.What is the way of applying cache=shared parameter in this type of 
> connection? SQLiteConnection conn = new SQLiteConnection ( "Data 
> Source=:memory:?cache=shared" ); is not working?

I think you should write SQLiteConnection("Data
Source=file::memory:?cache=shared"). But this possibility was
introduced in SQLite 3.7.13. So your asp.net provider should be
compiled with the latest version of SQLite, otherwise it won't work.

> 2.What is the way of creating a new connection for accessing the previously 
> opened in-memory database?

You should create new connection the same way as previously opened
one, i.e. SQLiteConnection("Data Source=file::memory:?cache=shared").


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

Reply via email to