Ejemplo n.º 1
0
 private void BindRepeator(int pageIndex, int pageSize)
 {
     using (SqlConnection sqlCon = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnection"].ToString()))
     {
         using (SqlCommand sqlCom = new SqlCommand("sp_GetMainboard_PageCount", sqlCon))
         {
             sqlCom.CommandType = CommandType.StoredProcedure;
             sqlCom.Parameters.AddWithValue("@pageIndex", pageIndex);
             sqlCom.Parameters.AddWithValue("@pageSize", pageSize);
             sqlCom.Parameters.Add("@recordCount", SqlDbType.Int, 4);
             sqlCom.Parameters["@recordCount"].Direction = ParameterDirection.Output;
             sqlCon.Open();
             IDataReader idr = sqlCom.ExecuteReader();
             try
             {
                 RepeaterMainBoardList.DataSource = idr;
                 RepeaterMainBoardList.DataBind();
                 idr.Close();
                 int recordCount = Convert.ToInt32(sqlCom.Parameters["@recordCount"].Value);
                 this.PopulatePager(recordCount, pageIndex, pageSize);
             }
             catch (Exception ex)
             {
                 Response.Write(ex.Message);
             }
             finally
             {
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void BindRepeator()
        {
            using (SqlConnection sqlCon = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnection"].ToString()))
            {
                SqlCommand sqlComm = new SqlCommand("sp_MainBoard_CRUD", sqlCon);
                sqlComm.CommandType = CommandType.StoredProcedure;
                sqlCon.Open();
                sqlComm.Parameters.Add("@mainBoardNo", SqlDbType.Int).Value           = 0;
                sqlComm.Parameters.Add("@userID", SqlDbType.NVarChar).Value           = "";
                sqlComm.Parameters.Add("@category", SqlDbType.NVarChar).Value         = "";
                sqlComm.Parameters.Add("@id_Name", SqlDbType.NVarChar).Value          = "";
                sqlComm.Parameters.Add("@mainBoardTitle", SqlDbType.NVarChar).Value   = "";
                sqlComm.Parameters.Add("@mainBoardContent", SqlDbType.NVarChar).Value = "";
                sqlComm.Parameters.Add("@writeDate", SqlDbType.DateTime).Value        = DateTime.Now;
                sqlComm.Parameters.Add("@StatementType", SqlDbType.NVarChar).Value    = "Select";

                RepeaterMainBoardList.DataSource = sqlComm.ExecuteReader();
                RepeaterMainBoardList.DataBind();
            }
        }