WPF:保存图像以进行访问?怎么样?

时间:2013-03-01 13:10:41

标签: wpf vb.net image ms-access adodb

我的浏览按钮有这样的代码。

'Dim dlg As New Microsoft.Win32.OpenFileDialog()
            ........................

            Dim result? As Boolean = dlg.ShowDialog()
            If result = True Then
                Dim filename As String = dlg.FileName
                brand_img.Source = New BitmapImage(New Uri(filename))
                tpath.Text = filename
            End If

然后我想将该图像保存在我的数据库中。怎么可能?谢谢他的帮助。我有一个像这样的保存按钮...

cn.ConnectionString = "Provider=Microsoft.Ace.Oledb.12.0; Data Source=" & My.Application.Info.DirectoryPath.ToString() & "\mvdata.accdb;"
            cn.Open()

            If rs.State = True Then rs.Close()
            rs.Open("Select * from company", cn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)

            If textbrname.Text = "" Or textbrdesc.Text = "" Then
                terr.Foreground = Brushes.Red
                terr.Text = "Please make sure that fields are not empty."
            Else
                rs.AddNew()
                rs("comp_imp").Value = ???????
                rs("comp").Value = textbrname.Text
                rs("comp_desc").Value = textbrdesc.Text
                rs.Update()
            End If
            rs.Close()
            cn.Close()

再次感谢你的帮助...

1 个答案:

答案 0 :(得分:0)

http://www.sourcecodester.com/visual-basic-net/5090/phone-book-using-vbnet-ms-access-2003.html

这是一个将图像存储在数据库中的简单程序..这对你有帮助,