我想在windows窗體文本框中輸入studentID,並且我想要相應的標籤將label1中的文本更改爲名稱列中的數據。我真的很困惑與代碼,因此下面。如何用列c中的文本替換標籤文本#
private void button1_Click(object sender, EventArgs e)
{
SqlCeConnection conn = new SqlCeConnection(@"Data Source=|datadirectory|databse.sdf");
conn.Open();
SqlCeCommand cmdSelect = conn.CreateCommand();
cmdSelect.CommandText = "SELECT * FROM StudentDetails WHERE StudentID = studentIDTextBox.Text";
SqlCeDataReader sr = cmdSelect.ExecuteReader();
DataSet sd = new DataSet();
}
/* using (SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter("SELECT * FROM StudentDetails WHERE StudentID = '" + studentIDTextBox.Text.ToString() + "'", conn)
{
// create the DataSet
DataSet ITIADataSet = new DataSet();
// fill the DataSet using our DataAdapter
dataAdapter.Fill();
}
}
*/
我猜你正在使用的WinForms? – 2013-03-14 14:33:08
是的,我正在使用通知。 – user2132038 2013-03-14 14:38:27