我在内存中创建数据库,在open() 的时候就报错,看了很多文档都没有找到答案,希望博客园有大牛帮忙解决下,先谢了
IDbConnection dbcon;
dbcon = (IDbConnection)new SQLiteConnection("URI=file::memory:,version=3");
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
// requires a table to be created named employee
// with columns firstname and lastname
// such as,
// CREATE TABLE employee (
// firstname varchar(32),
// lastname varchar(32));
string sql =
"SELECT firstname, lastname " +
"FROM employee";
dbcmd.CommandText = sql;
IDataReader reader = dbcmd.ExecuteReader();
while (reader.Read())
{
string FirstName = reader.GetString(0);
string LastName = reader.GetString(1);
Console.WriteLine("Name: " +
FirstName + " " + LastName);
}
// clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
你报啥错,你总得把错误贴出来吧。
URI=file::memory:,version=3
格式不对......你再检查检查吧......
跟你的错误一样,请问i后来解决了吗?