Posted on: 5/10/2011 4:59:11 AM | Views : 252

Hi Folks,
I am importing data from excel file into datareader and updating database table in sql server 2008. 
Problem is when i am reading data i have 118 rows (from 1 to 118).
but when i am inserting data into table its 118 (from 0 to 118) means record number 1 above is record 0 in
while dr.read
insert values
and i am getting exception on record 118 while inserting, it should end on 117.
any ideas??
Reading from excel 
Dim selQuery As String = "Select * FROM [table1$]" Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & filePath & ";Extended Properties=""Excel 12.0 Xml;HDR=YES;""") conn.Open() Dim cmdOle As New OleDbCommand(selQuery, conn) Dim dr As OleDbDataReader = cmdOle.ExecuteReader()
Inserting into tab ...

Go to the complete details ...