【发布时间】:2021-07-07 01:22:03
【问题描述】:
简短且可能很简单的问题,我不想在 dataGridView columnID 和其他几列中查看,因为查看该信息没有用处。
我有一个清晰的代码,连接已打开,数据加载正常,注释代码(顺便说一句,谷歌中最常见的解决方案)给出了包含所有列(无行)的空表。
我尝试了很多东西,我什至无法在其中列出它们:(
有什么想法吗?
DataTable SqlDataTable = new DataTable();
MySqlDataReader reader;
MySqlCommand sqlCommand = new MySqlCommand();
sqlCommand.Connection = sqlConnection;
sqlCommand.CommandText = "SELECT * FROM table_name";
reader = sqlCommand.ExecuteReader();
//while (reader.Read())
//{
// string columnID = reader["columnID"].ToString();
//}
SqlDataTable.Load(reader);
reader.Close();
sqlConnection.Close();
DataGridView = SqlDataTable;
【问题讨论】:
标签: c# mysql datagridview