I'm trying to run a
LoadAllImages(d s.Tables(0), "vcFileName ", "d:\Image")
Public Shared Sub LoadAllImages(B yVal 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.Row s
LoadImage(dr, ImageField, dr.Item(FilePat hField))
Next
End Sub
Public Shared Sub LoadImage(ByVal MyDataRow As System.Data.Dat aRow,
ByVal FilePath As String, ByVal ImageField As String)
Dim fs As New System.IO.FileS tream(FilePath, IO.FileMode.Ope n,
System.IO.FileA ccess.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.Unautho rizedAccessExce ption' 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.files tream.... 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(d s.Tables(0), "vcFileName ", "d:\Image")
Public Shared Sub LoadAllImages(B yVal 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.Row s
LoadImage(dr, ImageField, dr.Item(FilePat hField))
Next
End Sub
Public Shared Sub LoadImage(ByVal MyDataRow As System.Data.Dat aRow,
ByVal FilePath As String, ByVal ImageField As String)
Dim fs As New System.IO.FileS tream(FilePath, IO.FileMode.Ope n,
System.IO.FileA ccess.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.Unautho rizedAccessExce ption' 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.files tream.... 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
Comment