当我以ms访问更新图像时,我收到此错误:
无法找到d / bin / debug / openfilediloge1
当我选择另一张图片时
无法保存当前由其他用户锁定的
我的代码如下。
Private Sub Btnedit_Click(sender As Object, e As EventArgs) Handles Btnedit.Click
'Dim d As New DAL
'd.Dataedit("delete from labdetails")
'Pic.Image = Nothing
'MsgBox("من فضلك اختر صورة")
' btnsave_Click(Nothing, Nothing)
Try
Dim fsreader As New FileStream(dlgpics.FileName, FileMode.Open, FileAccess.Read)
Dim breader As New BinaryReader(fsreader)
Dim imgbuffer(fsreader.Length) As Byte
breader.Read(imgbuffer, 0, fsreader.Length)
fsreader.Close()
Dim strsql As String
Dim acscmd As New OleDbCommand
Dim con As New OleDbConnection
con = New OleDbConnection(("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath() & "\lab2015.accdb;Jet OLEDB:Database Password=mak;"))
strsql = "update labdetails set labnme=@labnme,labspecial=@labspecial,labadress=@labadress,labphone=@labphone,labtime=@labtime,lablogo=@lablogo,labprint=@labprint,labnameenglish=@labnameenglish,labspecialenglish=@labspecialenglish"
acscmd.CommandText = strsql
acscmd.Connection = con
acscmd.Parameters.AddWithValue("@labnme", txtlabname.Text)
acscmd.Parameters.AddWithValue("@labspecial", txtspeciality.Text)
acscmd.Parameters.AddWithValue("@labadress", txtadress.Text)
acscmd.Parameters.AddWithValue("@labphone", txtphone.Text)
acscmd.Parameters.AddWithValue("@labtime", txttime.Text)
acscmd.Parameters.AddWithValue("@lablogo", imgbuffer)
' If printchck.Checked = True Then
acscmd.Parameters.AddWithValue("@labprint", printchck.Checked)
acscmd.Parameters.AddWithValue("@labnameenglish", Txtlab.Text)
acscmd.Parameters.AddWithValue("@labspecialenglish", txtspecial.Text)
' Else
' acscmd.Parameters.AddWithValue("@labprint", "No")
' End If
con.Open()
acscmd.ExecuteNonQuery()
acscmd.Dispose()
Me.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
labdetails_Load(Nothing, Nothing)
End Sub