Start New Discussion within our Web Development Community

hi i have a table like this for attendence:

table name attendence.
id  
std_rolNum  
std_fname  
date  
std_bkfast  
std_lunch  
std_dinner

i want to make search on the base of date, std_rolnum, std_lunch, std_bkfast and std_dinner.

so that if on the same date if student have already taken breakfast, lunch or dinner he couldn't mark attendence.
so i have to select multiple columns like date and roll_number.
but i couldn't implement my logic in to c#....

thenx JorgeM for your reply. actually i have the following in c#:

SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=c:\users\shahaiali\documents\visual studio 2010\Projects\apps\Database1.mdf;Integrated Security=True;User Instance=True");

            string sql = @"select * from myTable where id = 3 ";
            string str;
            conn.Open();
                SqlDataAdapter da = new SqlDataAdapter(sql, conn);
                DataSet ds = new DataSet();

                da.Fill(ds, "myTable");
                DataTable dt = ds.Tables["myTable"];

                    foreach (DataRow row in dt.Rows)
                    {
                        str = Convert.ToString(row["fName"]);
                        if (str == "")
                        {
                            Console.WriteLine("invalid");
                        }
                        else
                        {
                            Console.WriteLine(str);
                        }

in my above scnario the condition is true mean there is no entry against the id 3. as the condition is true it couldn't enter to the block for empty value.

This question has already been answered. Start a new discussion instead.