当我尝试浏览并选择一些图像到图片框然后我点击更新按钮
弹出错误信息,显示无法保存当前由其他用户锁定。
If lblTable.Text = "Visitor_ApplyPass" Then
Dim fsr As New FileStream(OpenFileDialog1.FileName, FileMode.Open, FileAccess.Read)
Using br As New BinaryReader(fsr)
Dim imgbuffer(fsr.Length) As Byte
br.Read(imgbuffer, 0, fsr.Length)
fsr.Close()
Using con As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=..\VisitorPass.accdb")
con.Open()
Dim sql As String
sql = "Update " & lblTable.Text & " set Visitor_Name='" & txtName.Text & "',[Visitor_Photo]= @imgfile where [VisitorApply_ID]=" & lblID2.Text & ""
Using cmd As New OleDbCommand(sql, con)
cmd.Parameters.AddWithValue("@imgfile", imgbuffer)
cmd.ExecuteNonQuery()
MsgBox("profile is updated")
con.Close()
End Using
End Using
End Using
Me.Close()