using (SqlConnection myDatabaseConnection = new SqlConnection(myConnectionString.ConnectionString))
{
myDatabaseConnection.Open();
using (SqlCommand mySqlCommand = new SqlCommand("Select [EmpID], [Name], [Address], [Birthday] from EmpTable where EmpID = @EmpID", myDatabaseConnection))
SqlCommand.Parameters.AddWithValue("@EmpID", textBox1.Text);
{
using (SqlDataReader sqlreader = mySqlCommand.ExecuteReader())
{
if (sqlreader.Read())
{
textBox2.Text = sqlreader.GetInt32(sqlreader.GetOrdinal("EmpID")).ToString();
textBox3.Text = sqlreader.GetString(sqlreader.GetOrdinal("Name"));
textBox4.Text = sqlreader.GetString(sqlreader.GetOrdinal("Address"));
textBox5.Text = sqlreader.GetString(sqlreader.GetOrdinal("Birthday"));
}
}
}
}
我有这个来显示从数据库到文本框的数据。
如何将数据库中的数据加载到richBox?像这样的东西:
我可以在哪里突出显示数据并复制文本。