On Oct 15, 2010, at 11:40 PM, Schoinya wrote:

>
> Hello everybody
>
> I'm trying to attach on disk database to in memory database.
>
> But I get the strange error : SQLite error unrecognized token: ":"
>
> The following is the code:
>
>                SQLiteConnection connInMemory = new  
> SQLiteConnection("Data
> Source=:memory:");
>                connInMemory.Open();
>                SQLiteCommand commandInMemory = new  
> SQLiteCommand(@"ATTACH "
> +             Application.StartupPath + "\\Northwind.sl3" + " AS  
> disk",
> connInMemory);
>                commandInMemory.ExecuteNonQuery();
>
> I'm using System.Data.SQLite, in Visual Studio 2008, c#.
> I could connect and query the same database without an error using :
>
>                SQLiteConnection connOnDisk = new  
> SQLiteConnection("Data
> Source=" +
>                    Application.StartupPath +
> "\\Northwind.sl3;CacheSize=0");
>                connOnDisk.Open();
>                SQLiteCommand commandOnDisk = new  
> SQLiteCommand(connOnDisk);
>                commandOnDisk.CommandText = "select count(OrderID) from
> Orders";
>                commandOnDisk.ExecuteNonQuery();
>
> What is the problem?

Put quotes around the filename.

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

Reply via email to