I want to count Attendance column and display on textbox
hi,
i want to count Attendancecolumn and display on textbox.i have the following code but it gives error.give me proper code as soon as possible.
public void countattedence()
{
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\SJPDbase.mdb");
con.Open();
OleDbCommand cmd = new OleDbCommand("select count(Attendance) from dbo_Attandances where Emp_Name='" + cmbName.SelectedItem + "'", con);
//SqlDataReader dr;
OleDbDataReader dr;
dr = cmd.ExecuteReader();
while(dr.Read())
{
//int c = Convert.ToInt32( dr["Attendance"]);
txtprd.Text = dr["Attendance"].ToString();
}
con.Close();
}