示例#1
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            amount = Convert.ToInt32(TextBox1.Text);
            title  = Convert.ToString(TextBox2.Text);
            if (RadioButton1.Checked)
            {
                if (name1 == DropDownList1.SelectedItem.Text)
                {
                    pay1 = amount / 2;
                    pay2 = amount / 2;
                }

                if (name2 == DropDownList1.SelectedItem.Text)
                {
                    pay1 = amount / 2;
                    pay2 = amount / 2;
                }
            }

            qry = "insert into expense(trip,title,amount,f_name,s_name) values('" + trip + "','" + title + "','" + amount + "','" + pay1 + "','" + pay2 + "')";
            dbh = new DB_Handler();
            int row = dbh.execData(qry);

            if (row != 0)
            {
                TextBox1.Text = "";
                TextBox2.Text = "";
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            trip              = Convert.ToString(TextBox1.Text);
            f_name            = Convert.ToString(TextBox3.Text);
            mail              = Convert.ToString(TextBox4.Text);
            s_name            = Convert.ToString(TextBox5.Text);
            Session["trip"]   = TextBox1.Text;
            Session["f_name"] = TextBox3.Text;
            Session["mail"]   = TextBox4.Text;
            Session["s_name"] = TextBox5.Text;
            qry = "insert into details(trip,f_name,mail,s_name) values('" + trip + "','" + f_name + "','" + mail + "','" + s_name + "')";
            dbh = new DB_Handler();

            int row = dbh.execData(qry);


            Response.Redirect("Expense.aspx");
        }