使用C#、. NET CF 3.5,PPC 5在Sqlite中读取BLOB [英] Reading BLOB in Sqlite using C#, .NET CF 3.5, PPC 5
本文介绍了使用C#、. NET CF 3.5,PPC 5在Sqlite中读取BLOB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试以下代码:
I am trying this code:
private void GetImage(string fullName)
{
SQLiteConnection sqlite_con =
new SQLiteConnection("Data Source=|DataDirectory|dbasedict.s3db;" +
"Version=3;New=False;Compress=True;");
String querry2 = "select iimages from dictionario where word = '" +
searchBox.Text + "'";
SQLiteDataAdapter adap3 = new SQLiteDataAdapter(querry2, sqlite_con);
DataSet set = new DataSet();
adap3.Fill(set, "dictionario");
DataTable dataTable = new DataTable();
dataTable = (DataTable)set.Tables[0];
MemoryStream ms = null;
foreach (DataRow row in dataTable.Rows)
{
int id = Convert.ToInt32(row["iimages"]);
byte[ data = (byte[)row["dictionario"];
ms = new MemoryStream(data);
}
pictureBox1.Image = Image.FromStream(ms);
}
我收到语法错误,因为PPC 5不支持 fromstream .
然后,我在一个线程中发现可以将Bitmap方法用作PPC中fromstream的替代方法,并且找到了以下代码:
I get a syntax error because fromstream is not supported in PPC 5.
I then found in a thread that I can use the Bitmap method as an alternative of fromstream in PPC and I found this code:
public static Image GetImage(string fullName)
{
Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream file = thisExe.GetManifestResourceStream(fullName);
//Image image = Image.FromStream(file); // This won't work with the CF
// But this works in both environments!
Bitmap image = new Bitmap(file);
file.Close();
return image;
}
现在,我的问题是我不知道如何调试它,因为我只是开发.NET CF的新手.
任何人都可以帮助调试...
谢谢....
Now, my problem is I don''t know how to debug it because I am just a newbie in developing in .NET CF.
Can anyone help with the debugging please...
Thanks....
推荐答案
您可以像调试其他任何应用程序一样进行调试.如果您使用的是已安装的模拟器,Visual Studio将启动它并部署您的程序包.如果您正在使用连接到开发机器的设备,则需要设置使用它的选项,而不是仿真器.
You debug as you would any other application. If you are using the installed emulator Visual Studio will start it and deploy your package. If you are using a device connected to your development machine you need to set the options to use it rather than the emulator
如果我需要访问 mydb.sqlite 要访问,此连接字符串有效吗?
if i need to access mydb.sqlite to access, is this connection string works?
这篇关于使用C#、. NET CF 3.5,PPC 5在Sqlite中读取BLOB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文