示例#1
0
    private void ShowList()
    {
        string Sql07Str = "";

        Sql07Str = " select D7.DTLG000,SWC.SWC002,CONVERT(varchar(100), D7.DTLG002, 111) AS DTLG002 ,SWC.SWC005,SWC.SWC013,SWC.SWC000 from SWCDTL07 D7 LEFT JOIN SWCCASE SWC ON SWC.SWC000=D7.SWC000 ORDER BY D7.DTLG000 desc ";

        ConnectionStringSettings connectionString = ConfigurationManager.ConnectionStrings["SWCConnStr"];

        using (SqlConnection DTLConn = new SqlConnection(connectionString.ConnectionString))
        {
            DTLConn.Open();

            SqlDataReader readerItem07;
            SqlCommand    objCmdItem07 = new SqlCommand(Sql07Str, DTLConn);
            readerItem07 = objCmdItem07.ExecuteReader();

            int nI = 0;
            while (readerItem07.Read())
            {
                string dDTLG01 = readerItem07["DTLG000"] + "";
                string dDTLG02 = readerItem07["SWC002"] + "";
                string dDTLG03 = readerItem07["DTLG002"] + "";
                string dDTLG04 = readerItem07["SWC005"] + "";
                string dDTLG05 = readerItem07["SWC013"] + "";
                string dDTLG06 = readerItem07["SWC000"] + "";

                DataTable OBJ_GV07 = (DataTable)ViewState["GV07"];
                DataTable DTGV07   = new DataTable();

                if (OBJ_GV07 == null)
                {
                    DTGV07.Columns.Add(new DataColumn("DTLG001", typeof(string)));
                    DTGV07.Columns.Add(new DataColumn("DTLG002", typeof(string)));
                    DTGV07.Columns.Add(new DataColumn("DTLG003", typeof(string)));
                    DTGV07.Columns.Add(new DataColumn("DTLG004", typeof(string)));
                    DTGV07.Columns.Add(new DataColumn("DTLG005", typeof(string)));
                    DTGV07.Columns.Add(new DataColumn("DTLG006", typeof(string)));
                    DTGV07.Columns.Add(new DataColumn("DTLG007", typeof(string)));

                    ViewState["GV07"] = DTGV07;
                    OBJ_GV07          = DTGV07;
                }
                DataRow dr07 = OBJ_GV07.NewRow();

                dr07["DTLG001"] = dDTLG01;
                dr07["DTLG002"] = dDTLG02;
                dr07["DTLG003"] = dDTLG03;
                dr07["DTLG004"] = dDTLG04;
                dr07["DTLG005"] = dDTLG05;
                dr07["DTLG006"] = dDTLG06;
                dr07["DTLG007"] = nI++;

                OBJ_GV07.Rows.Add(dr07);

                ViewState["GV07"] = OBJ_GV07;

                SWCDTL07.DataSource = OBJ_GV07;
                SWCDTL07.DataBind();
            }
        }
    }
示例#2
0
 protected void SWCDTL07_PageIndexChanged(object sender, EventArgs e)
 {
     SWCDTL07.DataSource = ViewState["GV07"];
     SWCDTL07.DataBind();
 }