بســم الله الـرحمــن الرحيــم
المشكلة تتلخص في أنني كل ما أحاول أن أسترجع الملف المختار من الداتا غريد ,يرجع لي أول ملف تم تخزينه و في كل مرة يحصل ذلك هذا هو الكود أرجوا أن تصححوا لي الخطأ ...
Try
Dim con As New MySqlConnection _
("server=localhost;user id=root;Password=1;database=tawkeel;persist security info=True")
Dim da As New MySqlDataAdapter("Select * From tawkeelatt", con)
Dim MyCB As MySqlCommandBuilder = New MySqlCommandBuilder(da)
Dim ds As New DataSet()
con.Open()
da.Fill(ds, "tawkeelatt")
'0000000000000000000000000000
Dim myRow As DataRow
myRow = ds.Tables("tawkeelatt").Rows(0)
Dim MyData() As Byte
MyData = myRow("file")
Dim K As Long
K = UBound(MyData)
Dim file_Name As String
Dim sFile As String = ds.Tables("tawkeelatt").Rows(0)("name_contractor")
Dim nFile As String = ds.Tables("tawkeelatt").Rows(0)("name")
FolderBrowserDialog1.Description = ("إختر مكان حفظ الملف")
If FolderBrowserDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
file_Name = FolderBrowserDialog1.SelectedPath + "\" + nFile + " - " + sFile + ".zip"
Dim fs As New FileStream(file_Name, FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(MyData, 0, K)
fs.Close()
fs = Nothing
Else
Exit Sub
End If
'00000000000000000000000000
MyCB = Nothing
ds = Nothing
da = Nothing
con.Close()
con = Nothing
My.Forms.msg2.Label1.Text = "تم إسترجاع الملف من قاعدة البيانات"
My.Forms.msg2.ShowDialog()
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub