Excel DataBinding

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
 
P

Paul Clement

¤ 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)
 

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

Top