473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

First Record in DataSet corrupted

I have a web app that allows a user to upload an excel spread sheet and then
view it on the web (okay it does more than that but this is the part with a
problem).

The spread sheet uploads correctly, it even displays well in the data grid.
There is one problem however.

The first record always seems to be corrupt.

In my spreadsheet I have the following records:
456456456 456456456 John Doe 7057431006 fr**@abc.com

789789789 789789789 Frank Doe 7057431006 fr**@abc.com
123123123 123123123 Albert Doe 7057431006 fr**@abc.com
963963963 963963963 Johannus Doe 7057431006 fr**@abc.com
852852852 852852852 Jack Doe 7057431006 fr**@abc.com
741741741 741741741 Andrew Doe 7057431006 fr**@abc.com
Output from the data grid shows the exact same data EXCEPT the first row
is:'

F1 F2 John Doe F5 fred@abc#com

Does anyone have any idea what might be happening here?

here is the code:

<code>
Dim myds As New DataSet
Dim MyExcelConnectStr As String = "Provider=Microsoft.Jet.OLEDb.4.0;data
source=" & strFileName & ";Extended Properties=""Excel 8.0;"""

Dim MyOleADapter As New OleDb.OleDbDataAdapter("SELECT * FROM
[Sheet1$]", MyExcelConnectStr)

MyOleADapter.Fill(myds, "xlsdata")

DataGrid1.DataSource = myds.Tables(0)

DataGrid1.DataBind()

</code>
Nov 18 '05 #1
2 1177
CT
It looks as if the first row is treated as the field/column names, and where
a number is specified, it's replaced with F1, F2, and so on. Haven't worked
with Excel data, but I assume there's a setting to be specified to take care
of this. According to http://www.connectionstrings.com, you can specify the
HDR=No NVP as part of the Extended Properties attribute.

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
"Roger Twomey" <ro******@vnet.on.ca> wrote in message
news:OX**************@TK2MSFTNGP09.phx.gbl...
I have a web app that allows a user to upload an excel spread sheet and
then
view it on the web (okay it does more than that but this is the part with
a
problem).

The spread sheet uploads correctly, it even displays well in the data
grid.
There is one problem however.

The first record always seems to be corrupt.

In my spreadsheet I have the following records:
456456456 456456456 John Doe 7057431006 fr**@abc.com

789789789 789789789 Frank Doe 7057431006 fr**@abc.com
123123123 123123123 Albert Doe 7057431006 fr**@abc.com
963963963 963963963 Johannus Doe 7057431006 fr**@abc.com
852852852 852852852 Jack Doe 7057431006 fr**@abc.com
741741741 741741741 Andrew Doe 7057431006 fr**@abc.com
Output from the data grid shows the exact same data EXCEPT the first row
is:'

F1 F2 John Doe F5 fred@abc#com

Does anyone have any idea what might be happening here?

here is the code:

<code>
Dim myds As New DataSet
Dim MyExcelConnectStr As String =
"Provider=Microsoft.Jet.OLEDb.4.0;data
source=" & strFileName & ";Extended Properties=""Excel 8.0;"""

Dim MyOleADapter As New OleDb.OleDbDataAdapter("SELECT * FROM
[Sheet1$]", MyExcelConnectStr)

MyOleADapter.Fill(myds, "xlsdata")

DataGrid1.DataSource = myds.Tables(0)

DataGrid1.DataBind()

</code>

Nov 18 '05 #2
That was it.

Thank you.

I have added another site to my bookmarks.

"CT" <ca******@spammersgoawaydotnetservices.biz> wrote in message
news:e3**************@TK2MSFTNGP12.phx.gbl...
It looks as if the first row is treated as the field/column names, and where a number is specified, it's replaced with F1, F2, and so on. Haven't worked with Excel data, but I assume there's a setting to be specified to take care of this. According to http://www.connectionstrings.com, you can specify the HDR=No NVP as part of the Extended Properties attribute.

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
"Roger Twomey" <ro******@vnet.on.ca> wrote in message
news:OX**************@TK2MSFTNGP09.phx.gbl...
I have a web app that allows a user to upload an excel spread sheet and
then
view it on the web (okay it does more than that but this is the part with a
problem).

The spread sheet uploads correctly, it even displays well in the data
grid.
There is one problem however.

The first record always seems to be corrupt.

In my spreadsheet I have the following records:
456456456 456456456 John Doe 7057431006 fr**@abc.com

789789789 789789789 Frank Doe 7057431006 fr**@abc.com
123123123 123123123 Albert Doe 7057431006 fr**@abc.com
963963963 963963963 Johannus Doe 7057431006 fr**@abc.com
852852852 852852852 Jack Doe 7057431006 fr**@abc.com
741741741 741741741 Andrew Doe 7057431006 fr**@abc.com
Output from the data grid shows the exact same data EXCEPT the first row
is:'

F1 F2 John Doe F5 fred@abc#com

Does anyone have any idea what might be happening here?

here is the code:

<code>
Dim myds As New DataSet
Dim MyExcelConnectStr As String =
"Provider=Microsoft.Jet.OLEDb.4.0;data
source=" & strFileName & ";Extended Properties=""Excel 8.0;"""

Dim MyOleADapter As New OleDb.OleDbDataAdapter("SELECT * FROM
[Sheet1$]", MyExcelConnectStr)

MyOleADapter.Fill(myds, "xlsdata")

DataGrid1.DataSource = myds.Tables(0)

DataGrid1.DataBind()

</code>


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jéjé | last post by:
Hi, My dataset become corrupted after I have a storedprocedure. The error is: Failed to load dataset because of the following error: Cannot convert '' to type 'System.String' (there is no...
3
by: Owen Jenkins | last post by:
I have an Access 2000 app which is in use by about 20 clients on LANs where each LAN would have between 2 and 6 PCs networked. The main form is a tabbed form with multiple subforms. It has been in...
3
by: brucedodds | last post by:
My application has a form based on a parent table with a subform based on a child table. The relationship is Cascade Delete. The first record displayed when the form opens has five child records....
2
by: emphyrio | last post by:
Hi, I am new to programming in vb. net. I have this problem: I created a form with a datagrid. I can add records and then save them to a XML file, using this code on the click event of a button...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.