Need help with exception during some EXCEL automation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After sorting a dataset using a DataView and then creating a DataRowView I
get an Exception from HRESULT: 0x800A03EC on only one field in the
DataRowView.

code snippet:
xlWS.Cells(row, 1).Value = drvProd("RunNo")
xlWS.Cells(row, 2).Value = drvProd("CGN")
xlWS.Cells(row, 3).Value = ""
xlWS.Cells(row, 4).Value = drvProd("WorkOrder")
tempb = drvProd("Qty")

The error occurs on this next statement, tempb is diefined as an Int16 and
at least one record had a value of 16 but the exception was thrown anyway

xlWS.Cells(row, 5).Value = drvProd("Qty")
xlWS.Cells(row, 6).Value = drvProd("CoreType")
xlWS.Cells(row, 7).Value = drvProd("MandrelDiam")

What could be the cause of this problem
 
Instead of using drvProd("Qty") I used the value of tempb and it works just
fine. tempb is defined as an Int16 whereas drvProd("Qty") is coming from a
typed dataset where it is defined as type "Integer", "Decimal" types were not
causing problems coming out of the DataRowView.
 
Problem Solved -- Turns out the the data type of Integer in a typed Dataset
is a 64bit interger changing this to type "Int" resolved the issue -- looks
like Excel doesn't like these BIG INTEGER fields.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top