I already done with the retrival of file but I could not have all the files it only gives me one file..What I want is all the files with the same Id number should be retrieved and placed it in the listview after saving the file in a folder..
here is my code...
Private Sub getPic()
Dim dal As New DAL.DataAccess
Dim dr As MySqlDataReader
dal.ConnectionString = ls_connectionString
dal.Provider = EnumProviders.MySQL
Dim sql As String = "select * from trialpic"
dr = dal.ExecReader(sql, CommandType.Text)
If dr.Read Then
Try
Dim lb As Byte() = CType(dr.Item("picfile"), Byte())
selectImage(lb, 2)
Catch ex As Exception
MessageBox.Show(ex.Message, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End If
End Sub
Private Function selectImage(ByVal rawdata() As Byte, ByVal ImageIndex As Integer) As String
Dim str As String
Dim fs As FileStream
Dim pathImg As String = "C:\Users\jerome\Desktop\NCL1\NCL\bin\Debug\attachedFiles\"
Dim filename As String = Format(Now, "yyyyMMddhhmmss")
Try
str = pathImg & filename & ".png"
ListView1.Items.Add(str)
fs = New FileStream(str, FileMode.Create, FileAccess.Write)
fs.Write(rawdata, 0, UBound(rawdata) - 1)
fs.Close()
selectImage = str
Catch ex As Exception
MessageBox.Show(ex.Message, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
selectImage = ""
End Try
End Function
Private Sub viewAttachments_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles viewAttachments.Click
If GetINI2() = False Then
MessageBox.Show("Unable to read serverEly.INI", "System Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
getPic()
End If
End Sub
Jerome, if this helps please login to Mark As Answer. | Alert Moderator