我有一个SQLiteDatabas,我想将字节[]存储在名为“Data”的字段中,此时我使用的Datetype是所谓:Blob和字节数组存储在SQLiteDatabase的方法是这样的:在我的SQLiteDatabase在SQLite数据库中存储byte []并从SQLite数据库中选择字节[]
public bool InsertMessage()
{
//create string SQl and fill it with the SQLite query for inserting a message.
string SQL = "Insert into ClockMessages(InsertDateTime, SendDateTime, Data) Values('"+ insertdatetime + "', null, '" + data + "');";
List<SQLiteParameter> pars = new List<SQLiteParameter>();
pars.Add(new SQLiteParameter("InsertDateTime", insertdatetime));
pars.Add(new SQLiteParameter("Data", data));
//send the SQl query and it's parameters to the SQLiteDatabase class
return SQLiteDatabase.ExecuteNonQuery(SQL, pars);
}
现场数据字段现在包含了以下文字:System.Byte []
我想实际上在数据库中存储真正的字节[],我该如何实现?我是否需要另一个DateType作为数据字段?
您是将对象转换为字节数组,还是将字节数组转换为基数? – 2013-02-25 09:54:37
我还没有转换任何东西,我想在SQLite数据库中存储完整的字节数组,但如果需要的话,我可以减少字节数组中的单个字节,然后存储它们 – Max 2013-02-25 09:58:22
看起来好像有人已经标记了你的问题回答,但我在这里找不到一个例子,说明如何从数据库中取出数据。 – forcedfx 2014-03-12 11:50:03