您能帮助您找到解决方案吗?因为它的输出错误信息为"无法保存;目前被其他用户锁定。"
Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
If txtPassword.Text.ToString() = "" Then
MsgBox("do not empty")
ElseIf txtUsername.Text.ToString() = "" Then
MsgBox("do not empty")
ElseIf txtSurName.Text.ToString() = "" Then
MsgBox("do not empty")
ElseIf txtGivenName.Text.ToString() = "" Then
MsgBox("do not empty")
ElseIf txtMobile.Text.ToString() = "" Then
MsgBox("do not empty")
ElseIf txtAddress.Text.ToString() = "" Then
MsgBox("do not empty")
ElseIf txtIC.Text.ToString() = "" Then
MsgBox("do not empty")
Else
Dim gender As String
If RadioButton1.Checked = True Then
gender = "Male"
Else
gender = "Female"
End If
Dim fsr As New FileStream(OpenFileDialog1.FileName, FileMode.Open, FileAccess.Read)
Dim 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 HouseOwner set [Password]='" & txtPassword.Text & "',AccountName='" & txtUsername.Text & "',Houseowner_Surname='" & txtSurName.Text & "',Houseowner_GivenName='" & txtGivenName.Text & "',[IC]='" & txtIC.Text & "',[Mobile_No]='" & txtMobile.Text & "',Houseowner_address='" & txtAddress.Text & "',Gender='" & gender & "',[Photo]= @imgfile where [ID]=" & lblID.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
Me.Close()
End If
End Sub