retrive multiple attach files in mysql database

Posted by Jerome under VB.NET on 3/31/2012 | Points: 10 | Views : 1360 | Status : [Member] | Replies : 0
I have this code below for attaching multiple files...

Private Sub uploadFile()
Dim dal As New DAL.DataAccess
If GetINI2() = False Then
MessageBox.Show("Unable to read serverEly.INI", "System Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)

dal.ConnectionString = ls_connectionString
dal.Provider = EnumProviders.MySQL

Dim data As Byte() = Nothing
Dim row As DataRow
Dim i As Integer
Dim listofcolumn As New List(Of String)()
For Each column As ColumnHeader In ListView1.Columns

Dim table As New DataTable("nclattachments")
For Each column As String In listofcolumn
table.Columns.Add(column, GetType(String))

For Each item As ListViewItem In ListView1.Items
row = table.NewRow()
row(listofcolumn(i)) = item.Text
Dim fInfo As New FileInfo(item.Text)
Dim numbytes As Long = fInfo.Length
Dim fStream1 As New FileStream(item.Text, FileMode.Open, FileAccess.Read)
Dim br As New BinaryReader(fStream1)
data = br.ReadBytes(CInt(numbytes))
Dim attach As String = "INSERT INTO trialpic (picfile) VALUES (@trial)"

Dim Arlst As New Dictionary(Of String, Object)

Arlst.Add("@trial", data)

dal.ExecNonQuery(attach, CommandType.Text, Arlst)

Catch ex As Exception
MessageBox.Show(ex.Message, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
MsgBox("saved Successfully!", MsgBoxStyle.OkOnly, 64)
End If
End Sub

I put my files in a listview before I store it in the database..My problem is how can I retriev those files.I only have to search for the ID which holds multiple files in the databse and put it in a listview..How could I do this?please,I really need help....Thanks


(No response found.)

Login to post response