On Sep 14, 2011, at 4:45 PM, Mittchel wrote: > I habr to admit that I am new with Mono. I tryed to establish a connection > with Sqlite in monodroid. I am still having trouble with the database. If i > put the file in the root of the project would my conn string be this: Data > Source=myfile.db?
You'll notice that the original sample I showed you did something interesting: if the file didn't exist, it created it programmatically: bool exists = File.Exists (db); if (!exists) SqliteConnection.CreateFile (db); var conn = new SqliteConnection("Data Source=" + db); if (!exists) { var commands = new[] { "CREATE TABLE Items (Key ntext, Value ntext)", "INSERT INTO [Items] ([Key], [Value]) VALUES ('sample', 'text')", }; foreach (var cmd in commands) WithCommand (c => { c.CommandText = cmd; c.ExecuteNonQuery (); }); } return conn; If you don't want to programmatically create the database, and you instead want to bundle it with your app, what you'll need to do is place the database into your Assets folder, then use the Assets APIs to copy the database onto disk before you attempt to access it. Alternatively, you could embed the database as an assembly resource, then use the Reflection APIs to find and extract the resource. There is no other way to get files extracted on the device. You have to place them there, manually. - Jon _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid