예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            conn = new Connection();
           string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString;
            conn.Open(connectionstring); 
            UserID = (Request["UserID"]).Trim();
            Level = (Request["SecLevel"]).Trim();
            StationID = (Request["StationID"]).Trim();
            UserID = (Request["UserID"]).TrimEnd();
            SDay = Request["SDay"];
            SMonth = Request["SMonth"];
            SYear = Request["SYear"];
            NDay = Request["NDay"];
            NMonth = Request["NMonth"];
            NYear = Request["NYear"];
            // Search_Date = Strings.FormatDateTime(new DateTime(Convert.ToInt32(SYear), Convert.ToInt32(SMonth), Convert.ToInt32(SDay)), (DateFormat)2);
            //Search_NDate = Strings.FormatDateTime(new DateTime(Convert.ToInt32(NYear), Convert.ToInt32(NMonth), Convert.ToInt32(NDay)), (DateFormat)2);

            Search_Date = SDay + "/" + SMonth + "/" + SYear;
            Search_NDate = NDay + "/" + NMonth + "/" + NYear;
            fsql = "select * from MasterCoupon where RequestedID = " + StationID +
                " and  Present_Date >=   Convert(datetime, '" + Search_Date + "', 105) " +
                " and  Present_Date < DATEADD(dd,DATEDIFF(dd,0, Convert(datetime, '" + Search_NDate + "', 105)),0) + 1 " +
                " order by id desc";
            //response.write fsql
            //response.end
            RS1 = conn.Execute(fsql);
            Response.ContentType = "text/csv";
            //Today = Strings.FormatDateTime(DateTime.Now, (DateFormat)2);
            Today = DateTime.Now.ToString("dd-MM-yyyy");
            Response.AddHeader("Content-Disposition", "attachment;filename=§¨é¬ö¿ý(" + Today + ").csv");
             Write_CSV_From_Recordset(RS1);         
        }
        catch (Exception ex)
        { 
        }
    }