المشاركات : 1
المواضيع 0
الإنتساب : Dec 2018
السمعة :
0
الشكر: 0
تم شكره 0 مرات في 0 مشاركات
10-12-18, 03:49 PM
(آخر تعديل لهذه المشاركة : 10-12-18, 03:50 PM {2} بواسطة tuscake.)
(13-11-17, 03:40 AM)Mohammed Ismail كتب : Thank you so much, this will help my project in thesis
السلام عليكم
ادعم على Data بيز اكسيس 2007 - Separate connection mode - فيجول بيسك DotNet I
have a code to add different files to the database code is a problem in the add-in, although the data is moving in plain names in the field of texast and also the file conversion field to bytes
OLEObject
in the database b. A problem with the addition and non - deletion and non - restoration and error message when
![[صورة مرفقة: Untitled-6.jpg?dl=0]](https://www.dropbox.com/s/5i1zd6lk6odqypy/Untitled-6.jpg?dl=0)
adding codes, such as add file - delete - restore
كود :
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addpdf.Click
Try ' اضافة add file to access 2007
Using ofd As New OpenFileDialog
ofd.Filter = "Pdf files (*.pdf)|*.pdf|All Files (*.*)|*.*"
ofd.FilterIndex = 1
If ofd.ShowDialog = DialogResult.OK Then
If BindingSource1.Find("type_prod", ofd.FileName) = -1 Then
Dim drv As DataRowView = CType(BindingSource1.Current, DataRowView)
drv("type_prod") = ofd.FileName
drv("pic_prod") = IO.File.ReadAllBytes(ofd.FileName)
BindingSource1.EndEdit()
con.Open()
DataAdapter1.Update(DataSet1.Tables("purch_tb"))
con.Close()
Else
MessageBox.Show("الملف موجود بالفعل.", "اضافة ملف...")
End If
End If
End Using
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles delete.Click
' حذف delete file to access 2007
If DataGridView1.SelectedRows.Count > 0 Then
Dim dr As DialogResult = MessageBox.Show("هل تريد حذف الملف?", "حذف الملف...", MessageBoxButtons.YesNo)
If dr = DialogResult.Yes Then
BindingSource1.RemoveCurrent()
con.Open()
DataAdapter1.Update(DataSet1.Tables("purch_tb"))
con.Close()
End If
End If
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles restore.Click
' استعادة restore file to access 2007
If DataGridView1.SelectedRows.Count > 0 Then
Dim drv As DataRowView = CType(BindingSource1.Current, DataRowView)
Dim filename As String = drv("type_prod").ToString
If IO.File.Exists(filename) Then
Dim dr As DialogResult = MessageBox.Show("الملف المختار موجود ?", "استعادةالملف...", MessageBoxButtons.YesNo)
If dr = DialogResult.No Then Exit Sub
End If
IO.File.WriteAllBytes(filename, CType(drv("pic_prod"), Byte()))
Process.Start(filename)
MessageBox.Show("تم استعادة الملف..." & vbNewLine & filename, "Restore File...")
End If
End Sub
(13-11-17, 03:40 AM)Mohammed Ismail كتب : Thank you so much, this will help my project in thesis
السلام عليكم
ادعم على Data بيز اكسيس 2007 - Separate connection mode - فيجول بيسك DotNet I
have a code to add different files to the database code is a problem in the add-in, although the data is moving in plain names in the field of texast and also the file conversion field to bytes
OLEObject
in the database b. A problem with the addition and non - deletion and non - restoration and error message when
![[صورة مرفقة: Untitled-6.jpg?dl=0]](https://www.dropbox.com/s/5i1zd6lk6odqypy/Untitled-6.jpg?dl=0)
adding codes, such as add file - delete - restore
كود :
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addpdf.Click
Try ' اضافة add file to access 2007
Using ofd As New OpenFileDialog
ofd.Filter = "Pdf files (*.pdf)|*.pdf|All Files (*.*)|*.*"
ofd.FilterIndex = 1
If ofd.ShowDialog = DialogResult.OK Then
If BindingSource1.Find("type_prod", ofd.FileName) = -1 Then
Dim drv As DataRowView = CType(BindingSource1.Current, DataRowView)
drv("type_prod") = ofd.FileName
drv("pic_prod") = IO.File.ReadAllBytes(ofd.FileName)
BindingSource1.EndEdit()
con.Open()
DataAdapter1.Update(DataSet1.Tables("purch_tb"))
con.Close()
Else
MessageBox.Show("الملف موجود بالفعل.", "اضافة ملف...")
End If
End If
End Using
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles delete.Click
' حذف delete file to access 2007
If DataGridView1.SelectedRows.Count > 0 Then
Dim dr As DialogResult = MessageBox.Show("هل تريد حذف الملف?", "حذف الملف...", MessageBoxButtons.YesNo)
If dr = DialogResult.Yes Then
BindingSource1.RemoveCurrent()
con.Open()
DataAdapter1.Update(DataSet1.Tables("purch_tb"))
con.Close()
End If
End If
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles restore.Click
' استعادة restore file to access 2007
If DataGridView1.SelectedRows.Count > 0 Then
Dim drv As DataRowView = CType(BindingSource1.Current, DataRowView)
Dim filename As String = drv("type_prod").ToString
If IO.File.Exists(filename) Then
Dim dr As DialogResult = MessageBox.Show("الملف المختار موجود ?", "استعادةالملف...", MessageBoxButtons.YesNo)
If dr = DialogResult.No Then Exit Sub
End If
IO.File.WriteAllBytes(filename, CType(drv("pic_prod"), Byte()))
Process.Start(filename)
MessageBox.Show("تم استعادة الملف..." & vbNewLine & filename, "Restore File...")
End If
End Sub
|