Page 159 - ระบบสารสนเทศเพื่อการบริหารจัดการเอกสารอิเล็กทรอนิกส์ (e-Document)
P. 159
ห้องสมุดกรมพัฒนาที่ดิน
ค- 46
sSql += "WHERE (Promote.Promote_No IS NOT NULL) AND
(Promote.Promote_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 (Promote.Promote_YMD >= N'" + YMD1 + "') AND
(Promote.Promote_YMD <= N'" + YMD2 + "')";
sSql += " Order By Promote.Promote_YMD desc";
DbPromote.SelectCommand = sSql;
Session["SQL"] = sSql;
DbPromote.DataBind();
DbMgt table = new DbMgt(str);
MyDataSet ds = new MyDataSet(table.exReader(sSql));
}
}
protected void txtProNumSe_TextChanged(object sender, EventArgs e)
{
}
protected void reQuery()
{
string sSql = "";
sSql += "SELECT Promote.Promote_No, Promote.Promote_Number,
Promote.Promote_Title, RIGHT(Promote.Promote_YMD, 2) + '/' +
SUBSTRING(Promote.Promote_YMD, 5, 2) + '/' + CONVERT(varchar(4), CONVERT
(INT, LEFT(Promote.Promote_YMD, 4)) + 543) AS DMY ,
Promote.Promote_Priority, Promote.Promote_Bureau, Promote.Promote_Filename,
Piority.PriName ";
sSql += "FROM Promote INNER JOIN Piority ON
Promote.Promote_Priority = Piority.PriID ";
sSql += "WHERE (Promote.Promote_No IS NOT NULL) AND
(Promote.Promote_Status = N'1')";
if (txtProNumSe.Text != "")
sSql += " AND (Promote.Promote_Number LIKE '%" +
txtProNumSe.Text + "%')";
if (txtProTitleSe.Text != "")
sSql += " AND (Promote.Promote_Title LIKE '%" +
txtProTitleSe.Text + "%')";
string YMD1 = Request.Form["ddlDolY"] + Request.Form["ddlDolM"] +
Request.Form["ddlDolD"];
string YMD2 = Request.Form["ddlDolY2"] + Request.Form["ddlDolM2"] +
Request.Form["ddlDolD2"];
if (!YMD1.Contains("na") && !YMD2.Contains("na"))
sSql += " AND (Promote.Promote_YMD >= N'" + YMD1 + "') AND
(Promote.Promote_YMD <= N'" + YMD2 + "')";
sSql += " Order By Promote.Promote_YMD";
if (cbSortStyle.Checked)
sSql += " desc";
DbMgt table = new DbMgt(str);
MyDataSet ds = new MyDataSet(table.exReader(sSql));