我有一个问题: 我正在用数据库连接(acces数据库)制作日历应用程序。 有了这个应用程序,人们可以添加约会,并可以查看约会,如果他们按日期(例如3月24日)。 但现在显示了数据库的所有信息,这不是我想要的。 我想显示用户点击的按钮(日期)的约会,而不是数据库的所有oppaintments。如何在datagridview中显示特定日期的约会?(C#)
private void button2_Click(object sender, EventArgs e)
{
string selectie = " SELECT * FROM Appointment Order by AppointmentDate ";
OleDbConnection calendarconn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;data source=C:\Users\derek\Dropbox\C#_Project_Calender\Versie 1.0\Kalenderdb.accdb");
if (calendarconn != null)
{
Debug.WriteLine("calendarconn is not null: " + calendarconn);
calendarconn.Open();
OleDbCommand cmd = new OleDbCommand(selectie, calendarconn);
OleDbDataReader reader = cmd.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(reader);
// achter je grid
this.dataGridView1.DataSourc
日Thnx家伙我会尝试 – user2215242 2013-03-27 12:13:46