
October 2nd, 2012, 03:21 PM
|
 |
Contributing User
|
|
|
|
C# howto better handle array of data from mysql command
Code:
command.CommandText = "SELECT id, name, urgency, lastreply FROM tbltickets WHERE status = 'Open'";
connection.Open();
Reader = command.ExecuteReader();
while (Reader.Read()) {
string thisrow = "";
for (int i = 0; i < Reader.FieldCount; i++)
thisrow += Reader.GetValue(i).ToString() + ",";
outputBox.Items.Add(thisrow);
}
connection.Close();
Instead of adding the data to the listbox and referring to the rowdata by 0/1/2/3 how can I pull the data by field name (iid, name, urgency, lastreply)?
string thisrow = "http://urliwant2go2.com/ticket.php?id="+Reader.GetValue('id').ToString();
|