Click here to Skip to main content
15,896,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
Hi I have an access database and in database i create Three Table First Table Name Is Attandance, Second is Template And Third is Absent i want to filter which data not in Attandance filter by Only Today Date from Template table and i don't want old dated User ID and Insert in Absent Table

Table Details

Attandance Field = TemplateID(AutoNumber), UserID(Number),State(Text),Att_Date(Date/Time)

Template Field = TemplateID(AutoNumber),UserID(Number),Full_Name(Te xt),Age(Number)

Absent Field = TemplateID(AutoNumber), UserID(Number),State(Text),Att_Date(Date/Time)


my Coding as under but its its not working


C#
string[] mylist = new string[3000];
int i = 0;

str = "select a.*,b.* from Template a, Attandance b where a.UserID=b.UserID and ATT_Date="+mydate+"";//order by ATT_Date desc
cmd = new OleDbCommand(str, conn);
OleDbDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
    String ddate = dr[14].ToString().Substring(0, dr[14].ToString().Length - 11).Trim();
    if (ddate.Trim().Equals(mydate.Trim()) == false)
    {
        mylist[i] = dr[1].ToString();
        i++;
        dt.Rows.Add(dr[1].ToString(), dr[6].ToString(), dr[7].ToString() + dr[8].ToString(), dr[9].ToString(), dr[10].ToString(), ddate);
    }

}
dr.Close();
Posted
Updated 6-Sep-13 23:22pm
v2

SQL
select * from
Attandence 
Where 
date(Att_Date)>=cdate('2013-09-23')

Happy Coding!
:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900