Page 163 - ระบบสารสนเทศเพื่อการบริหารจัดการเอกสารอิเล็กทรอนิกส์ (e-Document)
P. 163
ห้องสมุดกรมพัฒนาที่ดิน
ค- 50
}
if (!IsPostBack)
{
GridView1.Visible = true;
string sSql = "";
sSql += "SELECT Deputy.Deputy_No, Deputy.Deputy_Number,
Deputy.Deputy_Title, RIGHT(Deputy.Deputy_YMD, 2) + '/' +
SUBSTRING(Deputy.Deputy_YMD, 5, 2) + '/' + CONVERT(varchar(4), CONVERT
(INT, LEFT(Deputy.Deputy_YMD, 4)) + 543) AS DMY , Deputy.Deputy_Priority,
Deputy.Deputy_Bureau, Deputy.Deputy_Filename, Piority.PriName ";
sSql += "FROM Deputy INNER JOIN Piority ON
Deputy.Deputy_Priority = Piority.PriID ";
sSql += "WHERE (Deputy.Deputy_No IS NOT NULL) AND
(Deputy.Deputy_Status = N'1')";
DateTime dt = new DateTime();
dt = DateTime.Today;
string YMD1 = (dt.Year * 10000 + dt.Month * 100 +
0).ToString();
string YMD2 = (dt.Year * 10000 + dt.Month * 100 +
31).ToString();
sSql += " AND (Deputy.Deputy_YMD >= N'" + YMD1 + "') AND
(Deputy.Deputy_YMD <= N'" + YMD2 + "')";
sSql += " Order By Deputy.Deputy_YMD desc";
DbMgt table = new DbMgt(str);
MyDataSet ds = new MyDataSet(table.exReader(sSql));
DbDeputy.SelectCommand = sSql;
Session["SQL"] = sSql;
DbDeputy.DataBind();
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs
e)
{
}
protected void reQuery()
{
string sSql = "";
sSql += "SELECT Deputy.Deputy_No, Deputy.Deputy_Number,
Deputy.Deputy_Title, RIGHT(Deputy.Deputy_YMD, 2) + '/' +
SUBSTRING(Deputy.Deputy_YMD, 5, 2) + '/' + CONVERT(varchar(4), CONVERT
(INT, LEFT(Deputy.Deputy_YMD, 4)) + 543) AS DMY , Deputy.Deputy_Priority,
Deputy.Deputy_Bureau, Deputy.Deputy_Filename, Piority.PriName ";
sSql += "FROM Deputy INNER JOIN Piority ON Deputy.Deputy_Priority =
Piority.PriID ";
sSql += "WHERE (Deputy.Deputy_No IS NOT NULL) AND
(Deputy.Deputy_Status = N'1')";
if (txtDeputyNumSe.Text != "")
sSql += " AND (Deputy.Deputy_Number LIKE '%" +
txtDeputyNumSe.Text + "%')";
if (txtDeputyTitleSe.Text != "")
sSql += " AND (Deputy.Deputy_Title LIKE '%" +
txtDeputyTitleSe.Text + "%')";

