我尝试将从Access数据库中提取的数据格式化为类似于数据库中的格式。
ID Name (Age)
Company Name
Handphone Number
NRIC
是否可以在gridview或Visual Studio WPF中的富文本框中执行此操作?
目前我的代码是:
OleDbConnection con = new OleDbConnection();
con.ConnectionString = ConfigurationManager.ConnectionStrings["Connection"].ToString();
con.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = "select ID,Name,Age,Company,Handphone,NRIC FROM Customers WHERE Name = @txtSearch";
cmd.Parameters.AddWithValue("@txtSearch", txtSearch.Text);
cmd.Connection = con;
OleDbDataReader rd = cmd.ExecuteReader();
grid1.ItemsSource = rd;