Tuesday, 10 September 2013

Sql query for two select statement

Sql query for two select statement

DateTime startDate = DateTime.ParseExact(txtstart.Text, "MM/dd/yyyy", null);
DateTime endDate = DateTime.ParseExact(txtend.Text, "MM/dd/yyyy", null);
string n1 = DropDownList2.SelectedItem.Text;
if (DropDownList1.SelectedItem.Text == "Membership")// here you can
add selectedindex as well
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["ProjectConnectionString"].ToString());
con.Open();
SqlDataAdapter adapter = new SqlDataAdapter("select * from
Membership_det where updateDate between @Start and @End and FID
="+n1+"", con);
adapter.SelectCommand.Parameters.Add("@Start",
SqlDbType.Date).Value = startDate;
adapter.SelectCommand.Parameters.Add("@End",
SqlDbType.Date).Value = endDate;
}
…….. …….. Above is a part of a code to display the data in the grid view.I
am displaying * from Membership_det and also need to display faculty name
from other table…how to add the query with the above query..displaying *
from membership _det table and faculty name from other table

No comments:

Post a Comment