I have a Grid View in which there is a Date column. In database I have one unique id column and a Date column. I want to get all the ids from the SQL query so that I can get all the ids for a particular date.
For example if I write "27-06-2013" then all ids 121,123,124 receive. When I am doing using Response.Write I am getting only a single id.
and all the ids then I want to show in grid view.
SqlCommand cmd = new SqlCommand("Select * from Scheduleappointment where Doctor_Id=@docid and Convert(varchar(5),Start_Time,108)+'-'+Convert(varchar(5),End_Time,108)=@time and Date=@date", con);
cmd.Parameters.AddWithValue("@docid", Label1.Text);
cmd.Parameters.AddWithValue("@time", timing.Text);
cmd.Parameters.AddWithValue("@date", Convert.ToDateTime(txtdate.Text).ToString("yyyy-MM-dd"));
conopen();
cmd.ExecuteNonQuery();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
Response.Write(dr["Id"].ToString());
}
I want to show these id values in single row of grid view.Like 121,123 in single row next to date 27-06-2013.