I am working on a project that requires me to connect to a mysql server. In order to create a more dynamic application, I am working on a way to pull the column names back into c# dynamically. At this point I have everything written except for the code where I get a result on the columns from the database, this is where I am stuck at.
I can't seem to be able to find a way to output the result I get back from mysql.
Any help with this is greatly appreciated.
I can't seem to be able to find a way to output the result I get back from mysql.
Any help with this is greatly appreciated.
Code:
public void sqlFields(string tblName) { MySqlConnection cnn = sqlConnection(); MySqlCommand cmd = new MySqlCommand(); string qryString = "SHOW COLUMNS FROM " + tblName; try { cmd.Connection = cnn; cmd.CommandText = qryString; cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); while (reader.Read()) { Debug.Write(reader); } } catch (Exception e) { MessageBox.Show(e.Message.ToString()); } }
Comment