Excel DataBinding

  • Thread starter Thread starter Richard Grene
  • Start date Start date
R

Richard Grene

I am binding an excel sheet with a datagrid using oledataconnection. The
problem I have is one of my Excel columns is filled with Invoice Numbers and
some numbers are numeric and some have aphanumeric. Even if I set the
Column to text, the numeric invoice fields come into the adapter as null.

Any suggestions?

Thanks,
Richard
 
¤ I am binding an excel sheet with a datagrid using oledataconnection. The
¤ problem I have is one of my Excel columns is filled with Invoice Numbers and
¤ some numbers are numeric and some have aphanumeric. Even if I set the
¤ Column to text, the numeric invoice fields come into the adapter as null.
¤

You need to specify the IMEX argument in your connection string to Excel:

ExcelConnection = New
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\Book10.xls;Extended Properties=""Excel 8.0;HDR=NO;IMEX=1;"""


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top