اين الخطا من فضلكم - safalo - 15-05-17
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
RE: اين الخطا من فضلكم - mazen1993 - 15-05-17
(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
أين رسالة الخطأ؟
![[صورة مرفقة: E:\iPhone9,3\photo]](http://vb4arb.com/vb/E:\iPhone9,3\photo)
أين رسالة الخطأ؟
RE: اين الخطا من فضلكم - safalo - 15-05-17
(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
أين رسالة الخطأ؟
![[صورة مرفقة: E:\iPhone9,3\photo]](http://vb4arb.com/vb/E:\iPhone9,3\photo)
أين رسالة الخطأ؟
لم استطيع ان اضيف صورة يقول لي ان حجم ها كبير
|