我遇到了一個問題:我不斷收到如下所示的消息,但添加按鈕正在工作(意味着它將數據添加到數據庫中)。爲什麼我不斷收到這條消息,但SQL語法正在工作
下面的錯誤出現在我每次按add
按鈕時。我更新了代碼。這是現在的showlist功能。
代碼:
void Showlist()
{
string sql = "SELECT studentnumber AS 'Student Number', lastname AS 'Last Name', firstname AS 'First Name', middlename AS 'Middle Name', picture AS 'Picture', course AS 'Course', year AS 'Year', section AS 'Section', partylist AS 'Partylist', information AS 'Information', position 'Position', election 'Election', FROM candidates";
MySqlDataAdapter adapter = new MySqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
adapter.Fill(ds, "candidates");
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "candidates";
}
什麼是錯誤? – adPartage
因爲我們並沒有對你所說的錯誤(你沒有告訴我們)的錯誤隱晦,我們不知道我們怎麼能幫你... – elgonzo
瘋狂的猜測? 'Showlist()'或'clear()'拋出異常。 – Crowcoder