Click here to Skip to main content
15,921,467 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
in Database records as follows;


Faculty Code Day (table name Leave)

AKR Wednesday
DOC Monday
LSG Wednesday


I have another Design screen as follows.


Faculty Code Combobox(in combobox all faculty retrieved from Leave table)

Calendar(Month Calendar)

when i select that month all date is display in datagridview.

Output as follows.

Select Month (name)


checkbox 1/2/2013
to
28/2/2013

when user select the faculty and select the Wednesday Date in datagridview means,
want to show the message for that date faculty is not available.

Because Wednesday Day is present in Leave Table.

How can i validate.

Please help me.

Regards,
Narasiman P.

Note it is windows application.
Posted
Comments
[no name] 23-Feb-13 1:50am    
please reply the answer for my above question

hi buddy

there is many way to do this task may some one told you smart way or some one not that way but over all as per my logic for this you have two task...

1. when user select the date of 1st table then you have to take that date in a variable(sql query).

2. and in 2nd and main task then using sql select with where='"+your variable+"' conditon query you have to read that day in secound table and if get HasRow= true or datareader dr.read() make true...then you have to finally pop up your massege that "Date Not Allowed"..

Are you getting na that what actually i want to share with you....have any doubt plz comment below or want logic from my end then also...but 1st try from your end...

Happy to help
 
Share this answer
 
like this...

C#
string selecdate; //in this variable get the selected date from gridview...
string query="select * from Leave where Codeday ='"+selecdate+"' and faculty_Name ='"+combobox1.slectedtext+"' "; 
con.open()
SqlCommand cmd=new sqlcommand(con,query)
sqlDataReader dr=cmd.executeReader(); 
 
if(dr.read())
{
messageBox.show("this faculty not available on this day");
}
else
{
messageBox.show("This faculty available on this day");
}
con.close();
 
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