hi i have a table like this for attendence:

table name attendence.

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#....

Recommended Answers

Did you already produce the SQL Query? What problem did you have in your c# logic?

Jump to Post

All 2 Replies

Did you already produce the SQL Query? What problem did you have in your c# logic?

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;
                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 == "")

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.