|
| Creating DataSet from excel file using Microsoft jet oledb. |
 |
Thu, 3 Apr 2008 19:34:04 +0000 |
I created a dataset from excel file using the code below
'****************************************************
Dim ConStr As String
ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;"
ConStr += "Data Source=" &
htmlPostedFile.PostedFile.FileName & ";"
ConStr += "Extended Properties= """ &
"Excel 8.0;HDR=YES;IMEX=1" & """"
Dim conn As New OleDbConnection(ConStr)
Dim cmd As New OleDbCommand("SELECT * FROM [Sheet1$]")
conn.Open()
cmd.Connection = conn
Dim Adapter As New OleDbDataAdapter(cmd)
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
Dim ds As New DataSet
DataSet ds = new DataSet();
Adapter.Fill(ds)
DataGrid1.DataSource = ds
DataGrid1.DataBind()
'****************************************************
The problem is Excel has 1 To 780 rows but I am getting only 779 in the dataset.
I am not getting the last row of the excel sheet.
Any Ideas? Where am I doing wrong?
Thanks in Advance
|
| Post Reply
|
| Re: Creating DataSet from excel file using Microsoft jet oledb. |
 |
Thu, 3 Apr 2008 22:46:14 +0000 |
appu_pen:Excel has 1 To 780 rows but I am getting only 779 in the dataset
780 - 1 = 779.
I think you are OK.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|