怎么将显示出来的数据添加到数据库里的另一张表里

来源:互联网 发布:注意事项网络图片 编辑:程序博客网 时间:2024/04/30 10:21
这是前台<table align="center" border="1" bordercolor="#cccc66" cellpadding="0" 
        cellspacing="0" 
        style="width: 513px; height: 355px; font-size: 9pt; background-image: url('file:///G:/mingrisoft/05/Image/例图/购物信息查询.jpg');">
        <tr>
            <td style="text-align: center">
                &nbsp;</td>
            <td colspan="3" style="text-align: center">
                === 商品详细信息 ===</td>
        </tr>
        <tr>
            <td colspan="2" rowspan="6" style="text-align: center;">
                <asp:Image ID="iGPhoto" runat="server" Height="160px" Width="136px" />
            </td>
            <td style="width: 100px; text-align: center; height: 30px;">
                商 品 ID:</td>
            <td style="width: 346px; height: 30px;">
                <asp:TextBox ID="txtGID" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 100px; text-align: center; height: 30px;">
                商品名称:</td>
            <td style="width: 346px; height: 30px;">
                <asp:TextBox ID="txtGName" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 100px; text-align: center; height: 30px;">
                商品类别:</td>
            <td style="width: 346px; height: 30px;">
                <asp:TextBox ID="txtGType" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 100px; text-align: center; height: 30px;">
                规格:</td>
            <td style="width: 346px; height: 30px;">
                <asp:TextBox ID="txtGStore" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 100px; text-align: center; height: 30px;">
                商品价格:</td>
            <td style="width: 346px; text-indent: 8pt; height: 30px;">
                <asp:TextBox ID="txtGPrice" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 100px; text-align: center; height: 30px;">
                库存量:</td>
            <td style="width: 346px; height: 30px;">
                <asp:TextBox ID="txtGDate" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="4">
                购买数量:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="btnShop" runat="server" Height="23px" onclick="btnShop_Click" 
                    Text="购买" Width="60px" />
            </td>
        </tr>
        <tr>
            <td colspan="4">
                商品介绍:</td>
        </tr>
        <tr>
            <td colspan="4" 
                style="height: 134px; vertical-align: top; text-indent: 8pt; text-align: center;">
                <asp:TextBox ID="txtGIntro" runat="server" Height="150px" ReadOnly="True" 
                    TextMode="MultiLine" Width="510px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="4" style="text-align: right; height: 24px;">
                &nbsp;&nbsp;</td>
        </tr>
    </table>
这是后台
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class Default3 : System.Web.UI.Page
{
   
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string ConnSql = System.Configuration.ConfigurationManager.ConnectionStrings["tourismConnectionString"].ConnectionString;
            SqlConnection Conn = new SqlConnection(ConnSql);
            Conn.Open();
            string strid = Page.Request.QueryString["SpecialProduct_ID"];
            string sqlstr = "select * from Special_Message where SpecialProduct_ID='" + strid + "'";
            SqlDataAdapter myda = new SqlDataAdapter(sqlstr, Conn );
            DataSet myds = new DataSet();
            myda.Fill(myds, "Special_Message");
            DataRowView mydrv = myds.Tables["Special_Message"].DefaultView[0];
            txtGID.Text = Convert.ToString(mydrv.Row["SpecialProduct_ID"]);
            txtGName.Text = Convert.ToString(mydrv.Row["SpecialProduct_Name"]);
            txtGType.Text = Convert.ToString(mydrv.Row["SpecialProduct_Kind"]);
            txtGStore.Text = Convert.ToString(mydrv.Row["SpecialProduct_Kind"]);
            txtGPrice.Text = Convert.ToString(mydrv.Row["SpecialProduct_Pricet"]);
            txtGDate.Text = Convert.ToString(mydrv.Row["SpecialProduct_Quantity"]);
            txtGIntro.Text = Convert.ToString(mydrv.Row["SpecialProduct_Charistirastic"]) + "…";
            iGPhoto.ImageUrl = Convert.ToString(mydrv.Row["SpecialProduct_Image"]);
        }
    }
    protected void btnShop_Click(object sender, EventArgs e)
    {
        if (Session["username"] != null)
        {
            Option.UpdateGoodsOrder(SpecialProduct_ID.Text, Session["username"].ToString(), Convert.ToInt32(TextBox1.Text.Trim()));
        }
        else
        {
            Response.Write("<script>alert('对不起,您还没有登陆,只有登陆后您才可以进行购买操作!');</script>");
        }
    }
        
}
请问怎样才能将上面的文本框里的数据添加到订单信息表里
原创粉丝点击