Click to See Complete Forum and Search --> : Simple Question - i dont understand this fully?


benq
06-11-2006, 11:37 AM
hello all

i,m trying to decipher this can some explain this to me in psuedocode or an explantion on what this does.

its simple but i cant put it in plain english or pseudocode



while (objRdr.Read())
{
txtName.Text = (string)objRdr["ItemName"];
txtImage.Text = (string)objRdr["ImageURL"];
txtQuantity.Text = (string)objRdr["Quantity"];
txtCost.Text = (string)objRdr["Cost"];
}
objRdr.Close();
objConn.Close();
recordupdate_btn.Enabled = true;
}


any help is greatly appreciated

thanks

bhar
06-13-2006, 02:27 AM
Hi,

Displaying data from the DataReader. Log on to http://www/vkinfotek.com for more articles on DataReader.

Regards
bhar

AlecW
06-14-2006, 05:13 PM
Basically what it is doing is looping thru a DataReader, while it has rows to loop thru. In each iteration of the loop, it is assigning values to the text properties of the 4 text boxes. Once that has comepleted, it closes the DataReader and the Connection, then enables a button.

IMHO, the code is flawed in the fact that it is using a while loop when it expects one row only. I believe it might be better to use the "if" statement to check to see if it has rows to read.

Hope this helps
Alec

hello all

i,m trying to decipher this can some explain this to me in psuedocode or an explantion on what this does.

its simple but i cant put it in plain english or pseudocode



while (objRdr.Read())
{
txtName.Text = (string)objRdr["ItemName"];
txtImage.Text = (string)objRdr["ImageURL"];
txtQuantity.Text = (string)objRdr["Quantity"];
txtCost.Text = (string)objRdr["Cost"];
}
objRdr.Close();
objConn.Close();
recordupdate_btn.Enabled = true;
}


any help is greatly appreciated

thanks