Select a particular record from Access database

Aug 27 2009 6:06 AM

Hai Experts...Please Help me........
I want to retrieve a particular item from the table schedule. I was using the following code....But error occures....
OleDbConnection
con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=RDSCHAGT1.mdb;User ID=;Password=;");
con.Open();
OleDbCommand cmd = con.CreateCommand();
cmd.CommandText =
"select listNo from schedule where EXTRACT(year from listdate)='" + year.Text + "' and EXTRACT(month from listdate)='" + month.Text + "' GROUP BY listNo";
cmd.Connection = con;
OleDbDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
comboBox1.Items.Add(dr[0]);

}
dr.Close();
 
Please Help me.......................

Answers (3)