J
JvCoach23
I'm trying to run a
LoadAllImages(ds.Tables(0), "vcFileName", "d:\Image")
Public Shared Sub LoadAllImages(ByVal MyDataTable As DataTable, ByVal
FilePathField As String, ByVal ImageField As String)
'loop through all the rows and load the images
For Each dr As DataRow In MyDataTable.Rows
LoadImage(dr, ImageField, dr.Item(FilePathField))
Next
End Sub
Public Shared Sub LoadImage(ByVal MyDataRow As System.Data.DataRow,
ByVal FilePath As String, ByVal ImageField As String)
Dim fs As New System.IO.FileStream(FilePath, IO.FileMode.Open,
System.IO.FileAccess.Read)
Dim Image(fs.Length) As Byte
fs.Read(Image, 0, fs.Length)
fs.Close()
MyDataRow.Item(ImageField) = Image
End Sub
I get the error An unhandled exception of type
'System.UnauthorizedAccessException' occurred in mscorlib.dll
Additional information: Access to the path "d:\Image" is denied.
This is happening on the dim fs as new system.io.filestream.... line.
I am a local adminstrator to my box. I'm running vb.net 2003 and am
trying to do this in a windows form. There is info in the dataset
table that I'm passing in. Can someone help me get around this problem
please
thanks
shannon
LoadAllImages(ds.Tables(0), "vcFileName", "d:\Image")
Public Shared Sub LoadAllImages(ByVal MyDataTable As DataTable, ByVal
FilePathField As String, ByVal ImageField As String)
'loop through all the rows and load the images
For Each dr As DataRow In MyDataTable.Rows
LoadImage(dr, ImageField, dr.Item(FilePathField))
Next
End Sub
Public Shared Sub LoadImage(ByVal MyDataRow As System.Data.DataRow,
ByVal FilePath As String, ByVal ImageField As String)
Dim fs As New System.IO.FileStream(FilePath, IO.FileMode.Open,
System.IO.FileAccess.Read)
Dim Image(fs.Length) As Byte
fs.Read(Image, 0, fs.Length)
fs.Close()
MyDataRow.Item(ImageField) = Image
End Sub
I get the error An unhandled exception of type
'System.UnauthorizedAccessException' occurred in mscorlib.dll
Additional information: Access to the path "d:\Image" is denied.
This is happening on the dim fs as new system.io.filestream.... line.
I am a local adminstrator to my box. I'm running vb.net 2003 and am
trying to do this in a windows form. There is info in the dataset
table that I'm passing in. Can someone help me get around this problem
please
thanks
shannon