sellershopinfo.aspx.cs

来自「This is not a very mean things.」· CS 代码 · 共 43 行

CS
43
字号
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 SellerShopInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        string str = "insert into Shop(CoalID, SellerID, BuyName, BuyTotal, BuyMoney) values(" + Convert.ToInt32(TextBox1.Text) + "," + Request.QueryString["SellerID"]
                        + ",'" + TextBox2.Text + "'," + Convert.ToInt32(TextBox3.Text) + "," + Convert.ToInt32(TextBox4.Text) + ")"; 
        SqlCommand myCommand = new SqlCommand(str, myConnection);

        try
        {
            myConnection.Open();
            myCommand.ExecuteNonQuery();
            myCommand.Dispose();
        }
        catch (SqlException ex)
        {
            Response.Write("Error:" + ex.Message);
        }
        finally
        {
            myConnection.Dispose();
            Response.Redirect("SellerShopInfo.aspx?SellerID=" + Session["SellerID"]);
        }
    }
}

⌨️ 快捷键说明

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