从数据库中检索图像(SQlite)

时间:2014-04-16 09:51:33

标签: c# sqlite windows-8.1

如何在Windows8.1商店应用程序中的sqlite数据库中存储和检索图像。我想这样做......

存储

if (MainTitle.Text == "ADD WEEKLY BUDGET LIST")
                {
                   Weekly Student1 = new Weekly
                    {
                        Title = title.Text,
                        Describtion = describtion.Text,
                        Category = category.PlaceholderText,
                        Date = dateFormatter.Format(date.Date),
                        Image = (browsePic.Background).ToString(),
                        Amount = amount.Text
                    };
                    conn.Insert(Student1);
                }

提取:

 dBPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "budget4");
            SQLiteConnection conn = new SQLiteConnection(dBPath);
            var query3 = conn.Table<Weekly>();
            var result3 = query3.ToList();
            foreach (var item in result3)
            {
                BitmapImage bit = new BitmapImage(new Uri(this.BaseUri, "Assets/images (2).jpg"));
                ImageBrush brush = new ImageBrush()
                {
                    ImageSource=bit
                };


                b.Add(new WeeklyClass(item.Title, item.Amount, item.Category, item.Date, item.Describtion, brush));
                financialStuffList.Add(new FinancialStuff() { Name = item.Title, Amount = item.Amount });
            }

我想浏览图像然后将其保存在SQLite中,然后检索它在边框中显示...

0 个答案:

没有答案