I'm querying an Excel Spreadsheet and populating a DataSet with the returned
data. This works fine, and I can bind to a datagrid without problem.
That's assuming I have the first row containing the column headings. If my
first row is data and *not* headings, I want to treat it as if there are
columns called Column0, Column1, Column2, etc.
If I iterate through the columns in the DataTable and set the ColumnName, it
seems to overwrite the first row of data, which I obviously can't have. The
alternative solution (I anticipated) would be to add a record after the bind
with Column0, Column1, etc. etc...but apparently after binding to Excel, the
DataTable has knowledge of the datatype, so if it makes the column of type
Double, then I can't very well add "Column4" in the first row, because the
cast will fail.
I've been scratching my head for far too long on this. Probably overlooking
something very simple, please enlighten me! 2 1109
What is your connection string ?
private static string GetExcelExtendedPropertiesValue(bool
headerRowExists)
{
return "'" + "Excel 8.0" + ";HDR=" + (string)(headerRowExists ? "Yes" :
"No") + ";IMEX=1'"; ;
}
"James" <mi*******@gmail.comwrote in message
news:Of**************@TK2MSFTNGP04.phx.gbl...
I'm querying an Excel Spreadsheet and populating a DataSet with the
returned
data. This works fine, and I can bind to a datagrid without problem.
That's assuming I have the first row containing the column headings. If
my
first row is data and *not* headings, I want to treat it as if there are
columns called Column0, Column1, Column2, etc.
If I iterate through the columns in the DataTable and set the ColumnName,
it
seems to overwrite the first row of data, which I obviously can't have.
The
alternative solution (I anticipated) would be to add a record after the
bind
with Column0, Column1, etc. etc...but apparently after binding to Excel,
the
DataTable has knowledge of the datatype, so if it makes the column of type
Double, then I can't very well add "Column4" in the first row, because the
cast will fail.
I've been scratching my head for far too long on this. Probably
overlooking
something very simple, please enlighten me!
A prince among men, thank you.
"sloan" <sl***@ipass.netwrote in message
news:eJ**************@TK2MSFTNGP03.phx.gbl...
>
What is your connection string ?
private static string GetExcelExtendedPropertiesValue(bool
headerRowExists)
{
return "'" + "Excel 8.0" + ";HDR=" + (string)(headerRowExists ? "Yes" :
"No") + ";IMEX=1'"; ;
}
"James" <mi*******@gmail.comwrote in message
news:Of**************@TK2MSFTNGP04.phx.gbl...
>I'm querying an Excel Spreadsheet and populating a DataSet with the
returned
>data. This works fine, and I can bind to a datagrid without problem. That's assuming I have the first row containing the column headings. If
my
>first row is data and *not* headings, I want to treat it as if there are columns called Column0, Column1, Column2, etc.
If I iterate through the columns in the DataTable and set the ColumnName,
it
>seems to overwrite the first row of data, which I obviously can't have.
The
>alternative solution (I anticipated) would be to add a record after the
bind
>with Column0, Column1, etc. etc...but apparently after binding to Excel,
the
>DataTable has knowledge of the datatype, so if it makes the column of type Double, then I can't very well add "Column4" in the first row, because the cast will fail.
I've been scratching my head for far too long on this. Probably
overlooking
>something very simple, please enlighten me!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Paul |
last post by:
Hi all
Arggghhh...........
The problem.....I want the user to be able to create an excel document and
name particular cells in the document where they want the data to be placed
and then save...
|
by: tkaleb |
last post by:
I have to create output file in a text, MS Access, MS Excel and .dbf format
from C# Win/ADO.NET application. Data are collected in DataSet and there is
no problem to make text file. However, I have...
|
by: kscdavefl |
last post by:
I am running the following code to retrieve a DataSet:
public DataView CreateGroupSource()
{
string groupConnect = Session.ToString();
string groupSelect = "Select grpname from Maxusergroups...
|
by: Hans [DiaGraphIT] |
last post by:
Hi!
I want to export a dataset to an excel file. I found following code on the
net...
( http://www.codeproject.com/csharp/Export.asp )
Excel.ApplicationClass excel = new ApplicationClass();...
|
by: Bernard O'Flynn |
last post by:
Hi
I have a pivot table that gets it data from another worksheet in the
workbook.
I need to update the data worksheet from data in a database (I'm using MS
Data Application Block) and get a...
|
by: Schultz |
last post by:
I would like to know if it is possible to import data from MS Excel
2000 to a dataset using asp.net. The excel file would need to be
uploaded to the server from a web page first, before the loaded...
|
by: Phoebe. |
last post by:
Hi, Good Day!
Reading 1 excel file into a dataset is fine.
How can I read multiple excel with the same data structure into 1 dataset?
How can I append those data?
Can someone help?
Thanks in...
|
by: Vanajakshi Pidatala |
last post by:
Hello,
I am trying to show data in dataset in to an excel
sheet(ASP.NET/VB.NET). I AM DOING THIS ON SERVER(IIS SERVER) WHICH HAS
EXCEL VERSION 9. I COULD ADD REFERENCE TO EXCEL VERSION 9 AND...
|
by: Ramakrishnan Nagarajan |
last post by:
Hi,
I am converting Excel data into a Dataset in C#. There are around 24 columns
in the Excel Sheet.
First I tried to insert one row with correct values in the Excel sheet. i.e.
for text columns...
|
by: =?Utf-8?B?Y29uc3RhbnRpbg==?= |
last post by:
I have problem with my code I need to read from Excel worksheet into dataset
the problem is in this line oleda.Fill(ds). The data adapter should fill
dataSet with data from Excel worksheet but...
|
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...
|
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...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
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...
|
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)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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....
|
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: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |