Click here to Skip to main content
15,908,455 members
Home / Discussions / C#
   

C#

 
QuestionUsing XPath in HTMLDocument Pin
jmd170112-Nov-06 15:51
jmd170112-Nov-06 15:51 
AnswerRe: Using XPath in HTMLDocument Pin
Christian Graus12-Nov-06 16:49
protectorChristian Graus12-Nov-06 16:49 
GeneralRe: Using XPath in HTMLDocument Pin
Guffa12-Nov-06 19:17
Guffa12-Nov-06 19:17 
GeneralRe: Using XPath in HTMLDocument Pin
Christian Graus12-Nov-06 20:02
protectorChristian Graus12-Nov-06 20:02 
GeneralRe: Using XPath in HTMLDocument Pin
Guffa12-Nov-06 21:23
Guffa12-Nov-06 21:23 
GeneralRe: Using XPath in HTMLDocument Pin
Christian Graus12-Nov-06 21:39
protectorChristian Graus12-Nov-06 21:39 
GeneralRe: Using XPath in HTMLDocument Pin
jmd170126-Nov-06 13:20
jmd170126-Nov-06 13:20 
QuestionSystem.Data.OleDb & Microsoft Excel [modified] Pin
shopi3012-Nov-06 13:22
shopi3012-Nov-06 13:22 
Hello Code Project Team.

Someone know how get the row index from excel spreadsheet?

Example:
[Profile.xls - spreadsheet1$]
<br />
   | FirstName | LastName    | Age |<br />
---|-----------|-------------|-----|<br />
 1 | Anthony   | Acuña       |  22 |<br />
 2 | Michael   | Danagan     |  24 |<br />
 3 | Benjamin  | Beat        |  24 |<br />
 4 | Monica    | Danagan     |  23 |<br />


C# Code
<br />
OleDbConnection conn = new OleDbConnection();<br />
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Profile.xls;Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1;MaxScanRows=0;\"";<br />
conn.Open();<br />
<br />
DataTable dt = new DataTable();<br />
<br />
string SQL = "SELECT * FROM [spreadsheet1$] WHERE FirstName LIKE 'M%'";<br />
OleDbDataAdapter da = new OleDbDataAdapter(SQL, conn);<br />
da.Fill(dt);<br />
<br />
this.dataGridView1.SuspendLayout();<br />
this.dataGridView1.DataSource = dt;<br />
this.dataGridView1.ResumeLayout();<br />


This work correctly and only show:

| FirstName | LastName    | Age |<br />
|-----------|-------------|-----|<br />
| Michael   | Danagan     |  24 |<br />
| Monica    | Danagan     |  23 |<br />


But I need retrieve what is the row index on excel file for every row.

I need show the info in DataGridView in the follow format:
<br />
| ExcelIndex | FirstName | LastName    | Age |<br />
|------------|-----------|-------------|-----|<br />
|          2 | Michael   | Danagan     |  24 |<br />
|          4 | Monica    | Danagan     |  23 |<br />


I hope that you can help me.

Thanks in advanced.




-- modified at 22:55 Sunday 12th November, 2006

SINCERELY.
ANTHONY ACUÑA

PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?

AnswerRe: System.Data.OleDb &amp;amp;amp; Microsoft Excel Pin
Anthony Mushrow13-Nov-06 12:59
professionalAnthony Mushrow13-Nov-06 12:59 
QuestionMaking a global variable Pin
Blekk12-Nov-06 12:02
Blekk12-Nov-06 12:02 
AnswerRe: Making a global variable Pin
Christian Graus12-Nov-06 12:20
protectorChristian Graus12-Nov-06 12:20 
GeneralRe: Making a global variable Pin
Blekk12-Nov-06 13:06
Blekk12-Nov-06 13:06 
GeneralRe: Making a global variable Pin
Anthony Mushrow12-Nov-06 13:12
professionalAnthony Mushrow12-Nov-06 13:12 
GeneralRe: Making a global variable Pin
Christian Graus12-Nov-06 13:57
protectorChristian Graus12-Nov-06 13:57 
AnswerRe: Making a global variable Pin
beatles169212-Nov-06 19:36
beatles169212-Nov-06 19:36 
GeneralRe: Making a global variable Pin
Blekk13-Nov-06 5:47
Blekk13-Nov-06 5:47 
GeneralRe: Making a global variable Pin
Blekk13-Nov-06 8:01
Blekk13-Nov-06 8:01 
QuestionSplitting a string message into a list of Objects Pin
kristamed12-Nov-06 11:50
kristamed12-Nov-06 11:50 
AnswerRe: Splitting a string message into a list of Objects Pin
Christian Graus12-Nov-06 12:05
protectorChristian Graus12-Nov-06 12:05 
AnswerRe: Splitting a string message into a list of Objects Pin
shopi3012-Nov-06 13:58
shopi3012-Nov-06 13:58 
AnswerRe: Splitting a string message into a list of Objects Pin
Alexandr Kovshovik12-Nov-06 20:36
Alexandr Kovshovik12-Nov-06 20:36 
QuestionHow to Set DataGridView.Rows[0].Visible To False ? Pin
hdv21212-Nov-06 10:27
hdv21212-Nov-06 10:27 
AnswerRe: How to Set DataGridView.Rows[0].Visible To False ? Pin
Christian Graus12-Nov-06 11:15
protectorChristian Graus12-Nov-06 11:15 
GeneralRe: How to Set DataGridView.Rows[0].Visible To False ? Pin
hdv21212-Nov-06 11:22
hdv21212-Nov-06 11:22 
GeneralRe: How to Set DataGridView.Rows[0].Visible To False ? Pin
Christian Graus12-Nov-06 12:06
protectorChristian Graus12-Nov-06 12:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.