标题:求救:数据库有关问题!
只看楼主
wdguozhen
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2006-12-6
得分:0 
第二部分如何存入数据库?
2013-05-01 10:29
wdguozhen
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2006-12-6
得分:0 
detail.aspx页
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<TABLE height=20 cellSpacing=0 cellPadding=0 width=644 border=0>
        <TBODY>
        <TR>
          <TD style="height: 273px">
            <TABLE cellSpacing=0 cellPadding=0 width=644 border=0>
              <TBODY>
              <TR>
                <TD></TD></TR>
              <TR>
                <TD vAlign=top align=middle >
                  <TABLE cellSpacing=0 cellPadding=0 width=640 border=0>
                    <TBODY>
                    <TR>
                      <TD align=middle width=423>
                          <asp:ImageMap ID="ImageMapPhoto" runat="server" ImageUrl="" ></asp:ImageMap></TD>
                      <TD vAlign=top width=217>
                        <TABLE cellSpacing=4 cellPadding=0 width=211
                        bgColor=#f8f8f8 border=0>
                          <TBODY>
                          <TR>
                            <TD class=zi3 style="COLOR: #666" align=left
                            bgColor=#ffffff
                            height=35> 名&nbsp;&nbsp;称:<asp:TextBox ID="Txtname" runat="server" Width="116px"></asp:TextBox></TD></TR>
                          <TR>
                            <TD class=zi3 style="COLOR: #666" align=left
                            bgColor=#ffffff height=35> 净含量:<asp:TextBox ID="Txtjhl" runat="server" Width="116px"></asp:TextBox></TD></TR>
                          <TR>
                            <TD class=zi3 style="COLOR: #666" align=left
                            bgColor=#ffffff height=35> 零售价:<asp:TextBox ID="Txtprice" runat="server" Width="116px"></asp:TextBox></TD></TR>
                          <TR>
                            <TD class=zi3 style="COLOR: #666" align=left
                            bgColor=#ffffff
                              height=35> 
                            </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
                  <TABLE height=26 cellSpacing=0 cellPadding=0 width=630
                  border=0>
                    <TBODY>
                    <TR>
                      <TD></TD></TR></TBODY></TABLE>
                  <TABLE cellSpacing=0 cellPadding=0 width=572 border=0>
                    <TBODY>
                    <TR>
                      <TD align=left>
                        <DIV class=ProContent><FONT
                        face=Arial>  </FONT></DIV></TD></TR>
                    <TR>
                      <TD><asp:textbox id="txtdetail" runat="server" Width="307px" Height="89px" TextMode="MultiLine" >></asp:textbox>
                          &nbsp;</TD></TR></TBODY></TABLE></TD></TR>
              <TR>
                <TD style="height: 12px"></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
</asp:Content>
2013-05-01 10:48
wdguozhen
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2006-12-6
得分:0 
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 detail : System.Web.UI.Page
{
    DBClass dbObj = new DBClass();
    CommonClass ccObj = new CommonClass();
    GoodsClass gcObj = new GoodsClass();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetGoodsInfo();
        }

    }
    /// <summary>
    /// 获取指定商品的信息,并将其显示在界面上
    /// </summary>
    public void GetGoodsInfo()
    {
        string strSql = "select * from tb_guozheninfo where guozhenID =" + Convert.ToInt32(Request["id"].Trim());
        SqlCommand myCmd = dbObj.GetCommandStr(strSql);
        DataTable dsTable = dbObj.GetDataSetStr(strSql, "tb_guozheninfo");
        this.ImageMapPhoto.ImageUrl = dsTable.Rows[0]["guozhenurl"].ToString();
        this.Txtname.Text = dsTable.Rows[0]["guozhenname"].ToString();
        this.Txtjhl.Text = dsTable.Rows[0]["jhl"].ToString();
        this.Txtprice.Text = dsTable.Rows[0]["price"].ToString();
        this.txtdetail.Text = dsTable.Rows[0]["detailsee"].ToString();
        
      
    }

    protected void btnBack_Click(object sender, EventArgs e)
    {
        string strUrl = Session["address"].ToString();
        Response.Redirect(strUrl);
    }
}
2013-05-01 10:49
wdguozhen
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2006-12-6
得分:0 
this.txtdetail.Text = dsTable.Rows[0]["detailsee"].ToString();
这个功能如何实现?
2013-05-01 10:50
wdguozhen
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2006-12-6
得分:0 
我的qq:26462556,本人想拜师,有愿意的请加我!谢谢!
2013-05-01 11:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-383447-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.220051 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved