27-10-24, 02:47 PM
اللهم آمين وإياكم أجمعين
أخي F.H.M جرب كود التعديل التالي :
وإن شاء الله سيشتغل .
أخي F.H.M جرب كود التعديل التالي :
وإن شاء الله سيشتغل .
كود :
Public Sub Update_Car_Arshef(ByVal Car_Doc As PictureBox, ByVal IDW As Long)
Try
Dim folderPath As String = Path.Combine(Application.StartupPath, "Images")
If Not Directory.Exists(folderPath) Then
Directory.CreateDirectory(folderPath)
End If
Dim imagePath As String = Path.Combine(folderPath, IDW.ToString() & ".jpg")
Car_Doc.Image.Save(imagePath, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim Cmd As New OleDbCommand
With Cmd
.Connection = con
.CommandType = CommandType.Text
.CommandText = "Update Car_Arshef Set Car_Doc = @Car_Doc Where ID = @ID"
.Parameters.Clear()
.Parameters.AddWithValue("@Car_Doc", imagePath)
.Parameters.AddWithValue("@ID", IDW)
End With
If con.State = ConnectionState.Open Then con.Close()
con.Open()
Cmd.ExecuteNonQuery()
con.Close()
MsgBox("تم تعديل السجل بنجاح", MsgBoxStyle.Information, "تعديل")
Catch ex As Exception
MsgBox("حدث خطأ أثناء محاولة تعديل الصورة" & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub![[صورة مرفقة: tawqeea.jpg]](https://i.postimg.cc/LsNRsFVH/tawqeea.jpg)

