I'm developing a program for a Windows Mobile Handheld 6.5.3 device (attention: compact framework!). The app is primary built for MySQL. As I want to be able to use different databases, I thought a factory-scheme would be the best way.
So I made a db factory out of a tutorial (http://ift.tt/1IVwRzn) and rewrote most of the database parts, so that it uses the correct interface methods.
Executing a query looks like this (simplified):
using (conn)
using (cmd)
{
conn.Open();
// Prepare query and stuff
//..
// Fetch results
conn.Close();
// check result
return result;
}
}
There is a chain of database queries depending on the result of the first query. Using my app with MySQL is no problem. But switching to SQLite throws an ObjectDisposedException at conn.Open() of the query that gets executed AFTER the FIRST one.
Any site/tutorial that writes about handling databases in c# refer to close the connection as soon as the query is done and - if you want to execute a new query - just open the connection again.
Why is SQLite having problems with my code? How can I get any tips from the debugger except for ObjectDisposed (as in: how to handle it with ensuring that mysql runs fine nonetheless)?
Some infos about the IDE, assemblys and the corresponding connectionstrings:
- Visual Studio 2008 Prof.
- MySQL Connector / .NET - 6.9.6.0
SERVER={0};DATABASE={1};UID={2};PASSWORD={3}
- System.Data.SQLite (http://ift.tt/1pLXZDc) - 1.0.97.0 PocketPC/ARM
- tried
Data Source=mydb.sqlite;Version=3;Pooling=True;Max Pool Size=100;FailIfMissing=True; - and
Data Source=mydb.sqlite;Version=3;FailIfMissing=True;
- tried
- same structure and values of databases
Aucun commentaire:
Enregistrer un commentaire