예제 #1
0
        protected void ViewPayment()
        {
            SqlConnection conn = new SqlConnection
                                     ("Server=DESKTOP-41H50KG\\SQLEXPRESS; Database=clubone; Uid=20201113; password=123456");

            conn.Open();

            SqlCommand cmd = new
                             SqlCommand("select pID as pID, amount as amount from Payment where Payment.userID = @UID", conn);

            cmd.Parameters.Add("@UID", System.Data.SqlDbType.Int, 100).Value = Session["user_id"];
            SqlDataAdapter adapter    = new SqlDataAdapter(cmd);
            DataTable      dt_payment = new DataTable();

            adapter.Fill(dt_payment);
            PaymentList.DataSource = dt_payment;
            PaymentList.DataBind();

            for (int i = 0; i < PaymentList.Rows.Count; ++i)
            {
                LinkButton btn = (LinkButton)PaymentList.Rows[i].FindControl("details");
                int        pID = Convert.ToInt32(PaymentList.Rows[i].Cells[0].Text);

                btn.PostBackUrl = "Receipt.aspx?id=" + pID;
            }
        }