really newbie question

  • Thread starter Thread starter Stephanie Stowe
  • Start date Start date
S

Stephanie Stowe

My brain is stuck in ADO and I seem to be having a hard time getting
unstuck. The MSDN help info on datasets is great for my understand what it
is and why it is and I love it. But I cannot get this simple little tutorial
to speak to me. I have

DateTime dWorkingDate = dtWorkingDate.Value;

dsSummary.Clear();
String sSql = "SELECT eDate, SUM(DATEDIFF([minute], eStart,
eEnd)) /60.00 AS Elapse, Comments FROM dbo.tEntries ";
sSql = sSql + "WHERE Day(eDate) = " + dWorkingDate.Day + " AND
Month(eDate) = " + dWorkingDate.Month + " AND Year(eDate) = " +
dWorkingDate.Year;
sSql = sSql + "GROUP BY eDate, Comments ";
SqlCommand cmd = new SqlCommand(sSql );

daSummary.SelectCommand = cmd;
daSummary.SelectCommand.Connection = cnSummary;
daSummary.Fill(dsSummary);

dsSummary is a dataset. I want to "loop" through all the rows and get the
value out of one of the columns. I have a single table, no relations... Can
someone give me a friendly nudge?

Let's say I want to get the value out of the first row in the elapse column.
What syntax? Thanks.
 
The following would do it :

Dim r as DataRow
For each r in dsSummary.Tables(0).rows
MessageBox.Show(r("elapse"))
Next

Steven
 
Sweet. Thanks. I feel very nudged. I never even thought of for each row in
rows. I was trying to do like dsSummary.Tables[0].Rows[1].Coluns.... it was
a mess. I am happy. Thanks.
Steven Licciardi said:
The following would do it :

Dim r as DataRow
For each r in dsSummary.Tables(0).rows
MessageBox.Show(r("elapse"))
Next

Steven

Stephanie Stowe said:
My brain is stuck in ADO and I seem to be having a hard time getting
unstuck. The MSDN help info on datasets is great for my understand what it
is and why it is and I love it. But I cannot get this simple little
tutorial
to speak to me. I have

DateTime dWorkingDate = dtWorkingDate.Value;

dsSummary.Clear();
String sSql = "SELECT eDate, SUM(DATEDIFF([minute], eStart,
eEnd)) /60.00 AS Elapse, Comments FROM dbo.tEntries ";
sSql = sSql + "WHERE Day(eDate) = " + dWorkingDate.Day + " AND
Month(eDate) = " + dWorkingDate.Month + " AND Year(eDate) = " +
dWorkingDate.Year;
sSql = sSql + "GROUP BY eDate, Comments ";
SqlCommand cmd = new SqlCommand(sSql );

daSummary.SelectCommand = cmd;
daSummary.SelectCommand.Connection = cnSummary;
daSummary.Fill(dsSummary);

dsSummary is a dataset. I want to "loop" through all the rows and get the
value out of one of the columns. I have a single table, no relations...
Can
someone give me a friendly nudge?

Let's say I want to get the value out of the first row in the elapse
column.
What syntax? Thanks.
 
Back
Top