I am importing data from excel into datagridview its kind of working fine.
my data is like this in excel

10001       MR NEW
10002       MR OLD
10003       MR CLEAN
1MB21       MR DIRTY
1BA12       MR DIXON
1EA12       MR RYDER

When I load the data all is loaded untill it gets to the Alpha numeric data

10001       MR NEW
10002       MR OLD
10003       MR CLEAN
blank       MR DIRTY
blank       MR DIXON
blank       MR RYDER







        Dim MyConnection As System.Data.OleDb.OleDbConnection
        Dim DtSet As System.Data.DataSet
        Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
        MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source='I:\Sales Analysis\Vecta\vecta customersmb.xls';Extended Properties=Excel 8.0;")
        MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [vecta customers$]", MyConnection)
        MyCommand.TableMappings.Add("Table", "Net-informations.com")
        DtSet = New System.Data.DataSet
        MyCommand.Fill(DtSet)
        DGVCustImport.DataSource = DtSet.Tables(0)
        MyConnection.Close()

Hi Mike,

If your Excelsheet was new, every blank cell has a NULL value which will create an error. Furthermore I do not see who you tell the routine until which row it has to read.

Good luck, Rene
(I am a bit short in time so I can't have a look at my own stuff, sorry!)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.