![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm trying to load a dataset from a spreadsheet into a grid for asp.net. I'm using Framework 3.5. I'm using the Access 2007 driver for oledb. The spreadsheet has 7,000 rows. I traced the process and after the .fill executes the dataobject (excelDS) has 563 rows. Where does this number come from? I'm only loading data from ONE column in the spreadsheet. ------------------------------------------------------------------------------------------------------------------------------------------------------ * * * * * * connString = "Provider=Microsoft.ACE.OLEDB.12..0;Data Source=" & savePath & ";Extended Properties=Excel 12.0" * * * * * * Dim oleDbConn = New OleDbConnection(connString) * * * * * * Dim oleDa = New OleDbDataAdapter() * * * * * * Dim cmd = New OleDbCommand("SELECT distinct address FROM [" & sName & "$] order by address", oleDbConn) * * * * * * oleDa.SelectCommand = cmd * * * * * * Dim excelDs = New DataSet * * * * * * oleDa.Fill(excelDs, "Address") * * * * * * * *'--- here's the fill * * * * * * Dim myDataColumn As DataColumn * * * * * * myDataColumn = New DataColumn() * * *'---here's where I stopped and checked the row count * * * * * * myDataColumn.DataType = Type.GetType("System.String") * * * * * * myDataColumn.ColumnName = "Not Found" * * * * * * excelDs.Tables(0).Columns.Add(myDataColumn) |
#3
| |||
| |||
|
|
I'm trying to load a dataset from a spreadsheet into a grid for asp.net. I'm using Framework 3.5. I'm using the Access 2007 driver for oledb. The spreadsheet has 7,000 rows. I traced the process and after the .fill executes the dataobject (excelDS) has 563 rows. Where does this number come from? I'm only loading data from ONE column in the spreadsheet. ------------------------------------------------------------------------------------------------------------------------------------------------------ connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & savePath & ";Extended Properties=Excel 12.0" Dim oleDbConn = New OleDbConnection(connString) Dim oleDa = New OleDbDataAdapter() Dim cmd = New OleDbCommand("SELECT distinct address FROM [" & sName & "$] order by address", oleDbConn) oleDa.SelectCommand = cmd Dim excelDs = New DataSet oleDa.Fill(excelDs, "Address") '--- here's the fill Dim myDataColumn As DataColumn myDataColumn = New DataColumn() '--- here's where I stopped and checked the row count myDataColumn.DataType = Type.GetType("System.String") myDataColumn.ColumnName = "Not Found" excelDs.Tables(0).Columns.Add(myDataColumn) |
#4
| |||
| |||
|
|
I'm trying to load a dataset from a spreadsheet into a grid for asp.net. I'm using Framework 3.5. I'm using the Access 2007 driver for oledb. The spreadsheet has 7,000 rows. I traced the process and after the .fill executes the dataobject (excelDS) has 563 rows. Where does this number come from? I'm only loading data from ONE column in the spreadsheet. ------------------------------------------------------------------------------------------------------------------------------------------------------ connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & savePath & ";Extended Properties=Excel 12.0" Dim oleDbConn = New OleDbConnection(connString) Dim oleDa = New OleDbDataAdapter() Dim cmd = New OleDbCommand("SELECT distinct address FROM [" & sName & "$] order by address", oleDbConn) oleDa.SelectCommand = cmd Dim excelDs = New DataSet oleDa.Fill(excelDs, "Address") '--- here's the fill Dim myDataColumn As DataColumn myDataColumn = New DataColumn() '--- here's where I stopped and checked the row count myDataColumn.DataType = Type.GetType("System.String") myDataColumn.ColumnName = "Not Found" excelDs.Tables(0).Columns.Add(myDataColumn) |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |