⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yinhang.aspx.cs

📁 Asp.net购物车示例源码[VS2005] 可以实现购物车基本功能:在线购物、在线结算、在线充值、在线支付(未完成) 有用户注册功能 默认用户密码51aspx 数据库文件在App
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class yinhang : System.Web.UI.Page
{
    static decimal sum1, sum2, sum3;
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button5_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx");
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (TextBox2.Text != "" && TextBox3.Text != "" && TextBox4.Text != "")
        {
            if (TextBox3.Text == TextBox4.Text)
            {
                string strCon2 = "Data Source=(local);Database=db_11;Uid=sa;Pwd=";
                string sqlstr2 = "insert yinhang (id,mima,money) values('" + TextBox2.Text.Trim() + "','" + TextBox3.Text.Trim() + "',0) ";
                SqlConnection sqlcon2 = new SqlConnection(strCon2);
                SqlCommand com2 = new SqlCommand(sqlstr2, sqlcon2);
                sqlcon2.Open();
                com2.ExecuteNonQuery();
                sqlcon2.Close();
                TextBox2.Text = "";
                Response.Write("<script>alert('注册成功')</script>");
            }
            else
            {
                Response.Write("<script>alert('密码不匹配')</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('注册信息不完整')</script>");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        TextBox2.Text = "";
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        string strCon = "Data Source=(local);Database=db_11;Uid=sa;Pwd=";
        string sqlstr = "select money from yinhang  where id ='" + this.TextBox1.Text.Trim() + " '";
        SqlConnection sqlcon = new SqlConnection(strCon);
        SqlCommand com = new SqlCommand(sqlstr, sqlcon);
        sqlcon.Open();
        SqlDataAdapter da = new SqlDataAdapter(sqlstr, sqlcon);
        DataSet ds = new DataSet();
        da.Fill(ds);
        sqlcon.Close();
        DataRow[] row1 = ds.Tables[0].Select();
        foreach (DataRow dr in row1)
        {
            sum1 = decimal.Parse(dr["money"].ToString().Trim());

        }
        ///////////////////////////////
        sum2 = decimal.Parse(TextBox5.Text.ToString());
        sum2 += sum1;
        //////////////////////////////////
        string sqlstr2 = "update yinhang set money = " + sum2 + " where  id= '" + TextBox1.Text.Trim() + " '";
        SqlCommand com2 = new SqlCommand(sqlstr2, sqlcon);
        sqlcon.Open();
        com2.ExecuteNonQuery();
        sqlcon.Close();
        Response.Redirect("yinhang.aspx");

    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        string strCon3 = "Data Source=(local);Database=db_11;Uid=sa;Pwd=";
        string sqlstr3 = "select id,money from yinhang  where id ='" + TextBox6.Text.Trim() + " '";
        SqlConnection sqlcon3 = new SqlConnection(strCon3);
        sqlcon3.Open();
        SqlDataAdapter da3 = new SqlDataAdapter(sqlstr3, sqlcon3);
        DataSet ds3 = new DataSet();
        da3.Fill(ds3);
        this.GridView1.DataSource = ds3;
        this.GridView1.DataBind();
        sqlcon3.Close();
        TextBox6.Text = "";
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -