私には2つのクエリがあり、その2つのクエリに対して2つのグリッドビューを取得しました
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つのSQLコマンド、2つのSqlDataAdapter、2つのデータセットを使用するのではなく、代替手段があります.....