A
ADM - Dan
I have an application that uses a file field control to get an Excel file
from the users local PC, then process the content of the file to update a
database table.
I am able to:
1. Get the file name
2. Use "postedFile.InputStream.Read(fileBytes, 0, FileLen)" to read the
file content into a byte array
3. Use "fStorage.Serialize(msStorage, fileBytes)" to serialize the byte
array into a memory stream.
When I try to deserialize the memory stream into a dataset, using "DS =
CType(fStorage.Deserialize(msStorage), DataSet)" or "DS =
fStorage.Deserialize(msStorage)", I get an error "Specified cast is not
valid".
What is happening here and how can I fix it? Could the binary formatter be
seeing that a column has numeric data in the first row, determining the
column should be of the integer data type based on the first row, then
encountering alpha data in the column?
Thanks.
from the users local PC, then process the content of the file to update a
database table.
I am able to:
1. Get the file name
2. Use "postedFile.InputStream.Read(fileBytes, 0, FileLen)" to read the
file content into a byte array
3. Use "fStorage.Serialize(msStorage, fileBytes)" to serialize the byte
array into a memory stream.
When I try to deserialize the memory stream into a dataset, using "DS =
CType(fStorage.Deserialize(msStorage), DataSet)" or "DS =
fStorage.Deserialize(msStorage)", I get an error "Specified cast is not
valid".
What is happening here and how can I fix it? Could the binary formatter be
seeing that a column has numeric data in the first row, determining the
column should be of the integer data type based on the first row, then
encountering alpha data in the column?
Thanks.