S
Shum
Hi all.. i have another problem! The Read() method is supposed to
read through all the rows one by one untill no row is left to be
read... but not in my case.. after mySqlDataReader.Read() returns
true first time and gives the value in nout. etc.. it works fine, i
mean it executes fine the first time but when again it comes to the
while statement , " mySqlDataReader.Read()" is false whereas its
supposed to be true .. i checked if values are being read, by the
following code:
while(mySqlDataReader.Read())
{
string
nout=System.Convert.ToString(mySqlDataReader["Outbreak"]);
MessageBox.Show(nout);
}
but when writen as below, its making me crazy... i can do it with the
dataset but wanted to use datareader. plz help if u know how to
overcome it
while(mySqlDataReader.Read())
{
string nout=System.Convert.ToString(mySqlDataReader["Outbreak"]);
MessageBox.Show(nout);
for(int ii=0;ii<=rowcount;ii++) //iterate through the dataset or rows
{
string pout=System.Convert.ToString(ds.Tables["Patients"].Rows[ii]
["OutbreakDisease"]);
if(pout==null)
{
break;
}
else if (pout==nout)
{
if (diseases[0]==null)
{
diseases[count]=pout;
count=count+1;
}
else
{
for(int bi=0;bi<count;bi++)
{
if (diseases[bi]==pout)
{
break;
}
else
{
diseases[count]=pout;
count=count+1;
}
}
}
else if (pout!=nout)
{
continue;
}
}
}
msg=diseases[0]+diseases[1]+" are on outbreak";
MessageBox.Show(msg,"ALERT",MessageBoxButtons.OK,MessageBoxIcon.Information);
mySqlDataReader.Close();
conn1.Close();
}
catch (Exception ex)
{
read through all the rows one by one untill no row is left to be
read... but not in my case.. after mySqlDataReader.Read() returns
true first time and gives the value in nout. etc.. it works fine, i
mean it executes fine the first time but when again it comes to the
while statement , " mySqlDataReader.Read()" is false whereas its
supposed to be true .. i checked if values are being read, by the
following code:
while(mySqlDataReader.Read())
{
string
nout=System.Convert.ToString(mySqlDataReader["Outbreak"]);
MessageBox.Show(nout);
}
but when writen as below, its making me crazy... i can do it with the
dataset but wanted to use datareader. plz help if u know how to
overcome it
while(mySqlDataReader.Read())
{
string nout=System.Convert.ToString(mySqlDataReader["Outbreak"]);
MessageBox.Show(nout);
for(int ii=0;ii<=rowcount;ii++) //iterate through the dataset or rows
{
string pout=System.Convert.ToString(ds.Tables["Patients"].Rows[ii]
["OutbreakDisease"]);
if(pout==null)
{
break;
}
else if (pout==nout)
{
if (diseases[0]==null)
{
diseases[count]=pout;
count=count+1;
}
else
{
for(int bi=0;bi<count;bi++)
{
if (diseases[bi]==pout)
{
break;
}
else
{
diseases[count]=pout;
count=count+1;
}
}
}
else if (pout!=nout)
{
continue;
}
}
}
msg=diseases[0]+diseases[1]+" are on outbreak";
MessageBox.Show(msg,"ALERT",MessageBoxButtons.OK,MessageBoxIcon.Information);
mySqlDataReader.Close();
conn1.Close();
}
catch (Exception ex)
{