我正在尝试使用一个调用类的方法studentHelper
来启动一个SELECT
然后在列表框中显示表数据,表是person
,列是personID
这是我的学生助手类
class studentHelperClass
{
/// <summary>
/// The SELECT method for the student
/// </summary>
public static void selectStudent()
{
MySqlConnection conn = connection();
conn.Open();
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = conn;
MySqlDataAdapter adap = new MySqlDataAdapter(@"SELECT * FROM person", conn);
MySqlCommandBuilder sqlCmd = new MySqlCommandBuilder(adap);
DataSet sqlSet = new DataSet();
adap.Fill(sqlSet, "personID");
conn.Close();
}
这是我的表格:
private void btnLoadListBox_Click(object sender, EventArgs e)
{
studentHelperClass.selectStudent();
}
它不起作用,我做错了什么?