我有七个字段需要填充到七个文本框中。数据来自 SQL Compact DB...
到目前为止,这是我的代码,但我被卡住了。我需要做什么来填充表单加载上的文本框......非常感谢。
伍迪
private void mcContactSubmit_Load(object sender, EventArgs e)
{
// Setup our SQL connection.
SqlCeConnection dataSource = new SqlCeConnection(
@"Data Source=|DataDirectory|\..\..\ContactInformation.sdf;
Persist Security Info=False");
SqlCeDataReader myReader = null;
// Create our command text.
string sqlQuery = String.Format(@"SELECT TOP (1) FirstName, LastName, Title,
Department, Category, Phone, Comments FROM ContactInformation
ORDER BY FirstName DESC");
// Open the SQL connection.
dataSource.Open();
SqlCeCommand myCommand = new SqlCeCommand(sqlQuery, dataSource);
myReader = myCommand.ExecuteReader();
}