Hi guys
I have a problem in my project.Below I mention the coding I wrote it for testing purpose.
In below coding the second while loop never run,only
SqlDataReader reader = DbCon.Get_Invoices();
int x = 0;
while (reader.Read())
{
x++; [B] 1[/B]
}
MessageBox.Show(x.ToString());
chart2.DataBindCrossTable(reader, "ExecutiveCode", "Date1", "Total", "");
foreach (Series series in chart2.Series)
{
series.ChartType = SeriesChartType.Line;
}
chart2.ResetAutoValues();
DataSet ds = new DataSet();
DataTable dt = ds.Tables.Add("tbldata");
int intIdx = 0;
for (int i = 0; i < reader.FieldCount; i++)
{
dt.Columns.Add(reader.GetName(i), reader.GetFieldTypei));
}
while (reader.Read())
{ [B]2[/B]
x++; }
MessageBox.Show(x.ToString());
while (reader.Read())
{ [B]3[/B]
MessageBox.Show("test");
DataRow r = dt.NewRow();
if (intIdx >= intSkip)
{
for (int i = 0; i < reader.FieldCount; i++)
{
r[i] = reader[i];
}
dt.Rows.Add(r);
}
In above coding 3rd while loop never runs and it never give me Meassage I expected.1 and 2 while loop work and I generate the x value also.Please tell me y that 3rd loop never work
Thanks
Tank50