I have wrote this method which I would like to display as output as a regular table.(For example column names followed by the data) I have not been able to find any method for this. Nor am I able to manipulate the WriteLine to accomplish this. Any ideas?
I am fairly new to programming and C#.
public void ShowQuery() //to be used with showing data
{
try
{
SqlDataReader reader = _mySqlCommand.ExecuteReader();
int columnCount = reader.FieldCount;
while(reader.Read()) //How can I use display results as a normal table like in access?
{
for (int i = 0; i < columnCount; i++)
{
Console.WriteLine( reader[i]);
}//end for
}//end while
reader.Close();
Console.Beep();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}