المشاركات : 31
المواضيع 12
الإنتساب : May 2017
السمعة :
1
الشكر: 0
تم شكره 5 مرات في 4 مشاركات
15-05-17, 04:01 PM
(آخر تعديل لهذه المشاركة : 15-05-17, 04:11 PM {2} بواسطة safalo.)
PHP كود :
Imports System.Data.SqlClient Imports System.IO Public Class Form1 Dim con As New SqlConnection("server=.; database =test; integrated security=true") Dim da As SqlDataAdapter Dim dt As New DataTable Dim cmd As New SqlCommand Dim dr As SqlDataReader Dim cmdb As New SqlCommandBuilder
Private Sub ListBoxFill() da = New SqlDataAdapter("select id , pdfname from table_1 ", con) da.Fill(dt) Me.ListBox1.DataSource = dt Me.ListBox1.ValueMember = "id" Me.ListBox1.DisplayMember = "pdfname"
End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load ListBoxFill()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim op As New OpenFileDialog op.Filter = "PDF files (*.pdf)|*.pdf" If op.ShowDialog = Windows.Forms.DialogResult.OK Then Dim data As Byte() = IO.File.ReadAllBytes(op.FileName) Dim sql As String = "INSERT INTO table_1 (pdfname, pdfdata) VALUES (@pdfname, @pdfdata)" Dim comm As New SqlCommand(sql, con) comm.Parameters.AddWithValue("@pdfname", IO.Path.GetFileName(op.FileName)) comm.Parameters.AddWithValue("@pdfdata", data)
con.Open()
comm.ExecuteNonQuery()
con.Close()
ListBoxFill()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If Me.ListBox1.SelectedValue Is Nothing Then Exit Sub
End If
Dim sql As String = "SELECT pdfname,pdfdata FROM table_1 WHERE id = " & Me.ListBox1.SelectedValue Dim da As New SqlDataAdapter(sql, con)
If da.Fill(dt) > 0 Then Dim row As DataRow = dt.Rows(0) Dim tmpPath As String = IO.Path.GetTempPath Dim fileName As String = tmpPath & "\" & row("pdfname") IO.File.WriteAllBytes(fileName, row("pdfdata")) Process.Start(fileName)
End If End Sub End Class
(15-05-17, 04:01 PM)safalo كتب : PHP كود :
Imports System.Data.SqlClient Imports System.IO Public Class Form1 Dim con As New SqlConnection("server=.; database =test; integrated security=true") Dim da As SqlDataAdapter Dim dt As New DataTable Dim cmd As New SqlCommand Dim dr As SqlDataReader Dim cmdb As New SqlCommandBuilder
Private Sub ListBoxFill() da = New SqlDataAdapter("select id , pdfname from table_1 ", con) da.Fill(dt) Me.ListBox1.DataSource = dt Me.ListBox1.ValueMember = "id" Me.ListBox1.DisplayMember = "pdfname"
End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load ListBoxFill()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim op As New OpenFileDialog op.Filter = "PDF files (*.pdf)|*.pdf" If op.ShowDialog = Windows.Forms.DialogResult.OK Then Dim data As Byte() = IO.File.ReadAllBytes(op.FileName) Dim sql As String = "INSERT INTO table_1 (pdfname, pdfdata) VALUES (@pdfname, @pdfdata)" Dim comm As New SqlCommand(sql, con) comm.Parameters.AddWithValue("@pdfname", IO.Path.GetFileName(op.FileName)) comm.Parameters.AddWithValue("@pdfdata", data)
con.Open()
comm.ExecuteNonQuery()
con.Close()
ListBoxFill()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If Me.ListBox1.SelectedValue Is Nothing Then Exit Sub
End If
Dim sql As String = "SELECT pdfname,pdfdata FROM table_1 WHERE id = " & Me.ListBox1.SelectedValue Dim da As New SqlDataAdapter(sql, con)
If da.Fill(dt) > 0 Then Dim row As DataRow = dt.Rows(0) Dim tmpPath As String = IO.Path.GetTempPath Dim fileName As String = tmpPath & "\" & row("pdfname") IO.File.WriteAllBytes(fileName, row("pdfdata")) Process.Start(fileName)
End If End Sub End Class
المشاركات : 8
المواضيع 0
الإنتساب : May 2017
الشكر: 2
تم شكره 2 مرات في 1 مشاركات
15-05-17, 04:26 PM
(آخر تعديل لهذه المشاركة : 15-05-17, 04:27 PM {2} بواسطة mazen1993.)
(15-05-17, 04:01 PM)safalo كتب : PHP كود :
Imports System.Data.SqlClient Imports System.IO Public Class Form1 Dim con As New SqlConnection("server=.; database =test; integrated security=true") Dim da As SqlDataAdapter Dim dt As New DataTable Dim cmd As New SqlCommand Dim dr As SqlDataReader Dim cmdb As New SqlCommandBuilder
Private Sub ListBoxFill() da = New SqlDataAdapter("select id , pdfname from table_1 ", con) da.Fill(dt) Me.ListBox1.DataSource = dt Me.ListBox1.ValueMember = "id" Me.ListBox1.DisplayMember = "pdfname"
End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load ListBoxFill()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim op As New OpenFileDialog op.Filter = "PDF files (*.pdf)|*.pdf" If op.ShowDialog = Windows.Forms.DialogResult.OK Then Dim data As Byte() = IO.File.ReadAllBytes(op.FileName) Dim sql As String = "INSERT INTO table_1 (pdfname, pdfdata) VALUES (@pdfname, @pdfdata)" Dim comm As New SqlCommand(sql, con) comm.Parameters.AddWithValue("@pdfname", IO.Path.GetFileName(op.FileName)) comm.Parameters.AddWithValue("@pdfdata", data)
con.Open()
comm.ExecuteNonQuery()
con.Close()
ListBoxFill()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If Me.ListBox1.SelectedValue Is Nothing Then Exit Sub
End If
Dim sql As String = "SELECT pdfname,pdfdata FROM table_1 WHERE id = " & Me.ListBox1.SelectedValue Dim da As New SqlDataAdapter(sql, con)
If da.Fill(dt) > 0 Then Dim row As DataRow = dt.Rows(0) Dim tmpPath As String = IO.Path.GetTempPath Dim fileName As String = tmpPath & "\" & row("pdfname") IO.File.WriteAllBytes(fileName, row("pdfdata")) Process.Start(fileName)
End If End Sub End Class
(15-05-17, 04:01 PM)safalo كتب : PHP كود :
Imports System.Data.SqlClient Imports System.IO Public Class Form1 Dim con As New SqlConnection("server=.; database =test; integrated security=true") Dim da As SqlDataAdapter Dim dt As New DataTable Dim cmd As New SqlCommand Dim dr As SqlDataReader Dim cmdb As New SqlCommandBuilder
Private Sub ListBoxFill() da = New SqlDataAdapter("select id , pdfname from table_1 ", con) da.Fill(dt) Me.ListBox1.DataSource = dt Me.ListBox1.ValueMember = "id" Me.ListBox1.DisplayMember = "pdfname"
End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load ListBoxFill()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim op As New OpenFileDialog op.Filter = "PDF files (*.pdf)|*.pdf" If op.ShowDialog = Windows.Forms.DialogResult.OK Then Dim data As Byte() = IO.File.ReadAllBytes(op.FileName) Dim sql As String = "INSERT INTO table_1 (pdfname, pdfdata) VALUES (@pdfname, @pdfdata)" Dim comm As New SqlCommand(sql, con) comm.Parameters.AddWithValue("@pdfname", IO.Path.GetFileName(op.FileName)) comm.Parameters.AddWithValue("@pdfdata", data)
con.Open()
comm.ExecuteNonQuery()
con.Close()
ListBoxFill()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If Me.ListBox1.SelectedValue Is Nothing Then Exit Sub
End If
Dim sql As String = "SELECT pdfname,pdfdata FROM table_1 WHERE id = " & Me.ListBox1.SelectedValue Dim da As New SqlDataAdapter(sql, con)
If da.Fill(dt) > 0 Then Dim row As DataRow = dt.Rows(0) Dim tmpPath As String = IO.Path.GetTempPath Dim fileName As String = tmpPath & "\" & row("pdfname") IO.File.WriteAllBytes(fileName, row("pdfdata")) Process.Start(fileName)
End If End Sub End Class
أين رسالة الخطأ؟
أين رسالة الخطأ؟
المشاركات : 31
المواضيع 12
الإنتساب : May 2017
السمعة :
1
الشكر: 0
تم شكره 5 مرات في 4 مشاركات
(15-05-17, 04:26 PM)mazen1993 كتب : (15-05-17, 04:01 PM)safalo كتب : PHP كود :
Imports System.Data.SqlClient Imports System.IO Public Class Form1 Dim con As New SqlConnection("server=.; database =test; integrated security=true") Dim da As SqlDataAdapter Dim dt As New DataTable Dim cmd As New SqlCommand Dim dr As SqlDataReader Dim cmdb As New SqlCommandBuilder
Private Sub ListBoxFill() da = New SqlDataAdapter("select id , pdfname from table_1 ", con) da.Fill(dt) Me.ListBox1.DataSource = dt Me.ListBox1.ValueMember = "id" Me.ListBox1.DisplayMember = "pdfname"
End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load ListBoxFill()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim op As New OpenFileDialog op.Filter = "PDF files (*.pdf)|*.pdf" If op.ShowDialog = Windows.Forms.DialogResult.OK Then Dim data As Byte() = IO.File.ReadAllBytes(op.FileName) Dim sql As String = "INSERT INTO table_1 (pdfname, pdfdata) VALUES (@pdfname, @pdfdata)" Dim comm As New SqlCommand(sql, con) comm.Parameters.AddWithValue("@pdfname", IO.Path.GetFileName(op.FileName)) comm.Parameters.AddWithValue("@pdfdata", data)
con.Open()
comm.ExecuteNonQuery()
con.Close()
ListBoxFill()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If Me.ListBox1.SelectedValue Is Nothing Then Exit Sub
End If
Dim sql As String = "SELECT pdfname,pdfdata FROM table_1 WHERE id = " & Me.ListBox1.SelectedValue Dim da As New SqlDataAdapter(sql, con)
If da.Fill(dt) > 0 Then Dim row As DataRow = dt.Rows(0) Dim tmpPath As String = IO.Path.GetTempPath Dim fileName As String = tmpPath & "\" & row("pdfname") IO.File.WriteAllBytes(fileName, row("pdfdata")) Process.Start(fileName)
End If End Sub End Class
(15-05-17, 04:01 PM)safalo كتب : PHP كود :
Imports System.Data.SqlClient Imports System.IO Public Class Form1 Dim con As New SqlConnection("server=.; database =test; integrated security=true") Dim da As SqlDataAdapter Dim dt As New DataTable Dim cmd As New SqlCommand Dim dr As SqlDataReader Dim cmdb As New SqlCommandBuilder
Private Sub ListBoxFill() da = New SqlDataAdapter("select id , pdfname from table_1 ", con) da.Fill(dt) Me.ListBox1.DataSource = dt Me.ListBox1.ValueMember = "id" Me.ListBox1.DisplayMember = "pdfname"
End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load ListBoxFill()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim op As New OpenFileDialog op.Filter = "PDF files (*.pdf)|*.pdf" If op.ShowDialog = Windows.Forms.DialogResult.OK Then Dim data As Byte() = IO.File.ReadAllBytes(op.FileName) Dim sql As String = "INSERT INTO table_1 (pdfname, pdfdata) VALUES (@pdfname, @pdfdata)" Dim comm As New SqlCommand(sql, con) comm.Parameters.AddWithValue("@pdfname", IO.Path.GetFileName(op.FileName)) comm.Parameters.AddWithValue("@pdfdata", data)
con.Open()
comm.ExecuteNonQuery()
con.Close()
ListBoxFill()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If Me.ListBox1.SelectedValue Is Nothing Then Exit Sub
End If
Dim sql As String = "SELECT pdfname,pdfdata FROM table_1 WHERE id = " & Me.ListBox1.SelectedValue Dim da As New SqlDataAdapter(sql, con)
If da.Fill(dt) > 0 Then Dim row As DataRow = dt.Rows(0) Dim tmpPath As String = IO.Path.GetTempPath Dim fileName As String = tmpPath & "\" & row("pdfname") IO.File.WriteAllBytes(fileName, row("pdfdata")) Process.Start(fileName)
End If End Sub End Class
أين رسالة الخطأ؟
أين رسالة الخطأ؟
لم استطيع ان اضيف صورة يقول لي ان حجم ها كبير
|