ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   can't fetch value in excel table if first 25 rows are empty (https://www.excelbanter.com/excel-programming/378646-cant-fetch-value-excel-table-if-first-25-rows-empty.html)

André

can't fetch value in excel table if first 25 rows are empty
 
Hi,

I don't now whether this is a problem with excel, with oledb provider or
asp.net, so i send it to those groups.

I created a table in excel with, to simplify, two fields and 30 records.
Now i fetch the values from that table with classic commands like:

Dim oConnection As OleDbConnection
Dim sConnection As String
oConnection = New OleDbConnection()
Dim comd As OleDbCommand
Dim dtreader As OleDbDataReader

SqlDataSource1.DataBind()
sConnection = SqlDataSource1.ConnectionString
oConnection.Open()
sql = "select * from data;"
comd = New OleDbCommand(sql, oConnection)
dtreader = comd.ExecuteReader
etc ...

My problem is this: suppose field1 is filled in each row, but field2 only
the last record. If the value of that last record is alfanumeric (e.g. a)
then no problem, dtreader can fetch it, but if it's numeric (e.g. 1),
dtreader doesn't fetch it (no value). When checking it with response.write,
i see the 'a' but no the 1.
The threshold is, according to trial and error, 25 rows. If the first 25
rows or more are empty, the numeric value in row 30 is 'lost', but not with
'a'.

Any acceptable reason for this?
Thanks
André



Tom Ogilvy

can't fetch value in excel table if first 25 rows are empty
 
See the following. Look for information on IMEX

http://support.microsoft.com/default...b;en-us;257819
How To Use ADO with Excel Data from Visual Basic or VBA


http://www.dicks-blog.com/archives/2...ed-data-types/

--
Regards,
Tom Ogilvy


"André" <hjhhb@dd wrote in message
...
Hi,

I don't now whether this is a problem with excel, with oledb provider or
asp.net, so i send it to those groups.

I created a table in excel with, to simplify, two fields and 30 records.
Now i fetch the values from that table with classic commands like:

Dim oConnection As OleDbConnection
Dim sConnection As String
oConnection = New OleDbConnection()
Dim comd As OleDbCommand
Dim dtreader As OleDbDataReader

SqlDataSource1.DataBind()
sConnection = SqlDataSource1.ConnectionString
oConnection.Open()
sql = "select * from data;"
comd = New OleDbCommand(sql, oConnection)
dtreader = comd.ExecuteReader
etc ...

My problem is this: suppose field1 is filled in each row, but field2 only
the last record. If the value of that last record is alfanumeric (e.g. a)
then no problem, dtreader can fetch it, but if it's numeric (e.g. 1),
dtreader doesn't fetch it (no value). When checking it with
response.write, i see the 'a' but no the 1.
The threshold is, according to trial and error, 25 rows. If the first 25
rows or more are empty, the numeric value in row 30 is 'lost', but not
with 'a'.

Any acceptable reason for this?
Thanks
André




André

can't fetch value in excel table if first 25 rows are empty
 
Thanks

"Tom Ogilvy" schreef in bericht
...
See the following. Look for information on IMEX

http://support.microsoft.com/default...b;en-us;257819
How To Use ADO with Excel Data from Visual Basic or VBA


http://www.dicks-blog.com/archives/2...ed-data-types/

--
Regards,
Tom Ogilvy


"André" <hjhhb@dd wrote in message
...
Hi,

I don't now whether this is a problem with excel, with oledb provider or
asp.net, so i send it to those groups.

I created a table in excel with, to simplify, two fields and 30 records.
Now i fetch the values from that table with classic commands like:

Dim oConnection As OleDbConnection
Dim sConnection As String
oConnection = New OleDbConnection()
Dim comd As OleDbCommand
Dim dtreader As OleDbDataReader

SqlDataSource1.DataBind()
sConnection = SqlDataSource1.ConnectionString
oConnection.Open()
sql = "select * from data;"
comd = New OleDbCommand(sql, oConnection)
dtreader = comd.ExecuteReader
etc ...

My problem is this: suppose field1 is filled in each row, but field2 only
the last record. If the value of that last record is alfanumeric (e.g. a)
then no problem, dtreader can fetch it, but if it's numeric (e.g. 1),
dtreader doesn't fetch it (no value). When checking it with
response.write, i see the 'a' but no the 1.
The threshold is, according to trial and error, 25 rows. If the first 25
rows or more are empty, the numeric value in row 30 is 'lost', but not
with 'a'.

Any acceptable reason for this?
Thanks
André







All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com