我有两个查询,对于这两个查询,我采取了两个网格视图
select course_name , start_date, end_date, timings, fee, branch_code from coursesprovided where start_date>=Getdate() and branch_code='Ameerpet'
select course_name , start_date, end_date, timings, fee, branch_code from coursesprovided where start_date>=Getdate() and branch_code='Hi-Tech City'
在我的页面加载期间,我需要在网格视图中显示数据。
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Data Source=(local); Initial Catalog=gateway; User Id=sa; Password=wilshire@rnd; Integrated Security=false";
//Assigning Query
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select course_name , start_date, end_date, timings, fee, branch_code from coursesprovided where start_date>=Getdate() and branch_code='Ameerpet'";
cmd.CommandText = "select course_name , start_date, end_date, timings, fee, branch_code from coursesprovided where start_date>=Getdate() and branch_code='Ameerpet'";
cmd.CommandType = CommandType.Text;
//Execute the COmmand
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
gvap.DataSource = ds;
gvap.DataBind();
}
除了采用2 个 SQLcommands、2 个 SqlDataAdapter、2 个数据集之外,还有其他选择吗.....