毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 课程设计 >> 正文

基于.NET的网上商城系统的分析与设计 第8页

更新时间:2008-2-28:  来源:毕业论文

基于.NET的网上商城系统的分析与设计 第8页

 GetDataListData("select * from Products inner join Pictures on Products.PictureID=Pictures.PictureID");

            bbsshow();

        }

    }

    ConnectionStringSettings sets = ConfigurationManager.ConnectionStrings["DBConnection"];

    SqlConnection conn;

    protected void bbsshow()

    {

        conn = new SqlConnection(sets.ConnectionString);

        SqlCommand cmd = new SqlCommand("select bbscontent from BBS ", conn);

        conn.Open();

        SqlDataReader reader = cmd.ExecuteReader();

        while (reader.Read())

        {

            Label2.Text += reader.GetString(0) + "<br>";

        }

        reader.Close();

        conn.Close();

    }

    private void GetSourceListData()

    {

        SourceList.Items.Clear();

        conn = new SqlConnection(sets.ConnectionString);

        SqlCommand cmd = new SqlCommand("select CategoryID,Description from Categorys order by CategoryID", conn);

        conn.Open();

        SqlDataReader reader = cmd.ExecuteReader();

        while (reader.Read())

        {

            SourceList.Items.Add(new ListItem(reader["Description"].ToString(), reader["CategoryID"].ToString()));

        }

        reader.Close();

        conn.Close();

    }

    private void GetDataListData(string sqlStr)

    {

        conn = new SqlConnection(sets.ConnectionString);

        SqlDataAdapter da = new SqlDataAdapter(sqlStr, conn);

        DataSet ds = new DataSet();

        da.Fill(ds);

        DataList1.DataSource = ds;

        DataList1.DataBind();

     }

    protected void Button1_Click(object sender, EventArgs e)

    {

        GetDataListData("select * from Products inner join Categorys on Products.CategoryID=Categorys.CategoryID "

            + "inner join Pictures on Products.PictureID=Pictures.PictureID where Categorys.CategoryID=" + Convert.ToInt32(SourceList.SelectedValue));

    }

    protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)

    {

        if (e.CommandName == "image")

        {

            int product_id = Convert.ToInt32(DataList1.DataKeys[e.Item.ItemIndex]);

            Session["product_id"] = product_id;

            Response.Redirect("B2Cmain1.aspx");

        }

    }

    protected void LinkButton1_Click(object sender, EventArgs e)

    {

        Response.Redirect("Default.aspx");

    }

    protected void LinkButton2_Click(object sender, EventArgs e)

    {

        Response.Redirect("zxhIndex.aspx");

    }

}

用户注册实现代码(Regist.aspx.cs)

public partial class Regist : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

    }

    protected void handon_Click(object sender, EventArgs e)

    {

        zhuce();

    }

    protected void zhuce()

    {

        ConnectionStringSettings sets = ConfigurationManager.ConnectionStrings["DBConnection"];

        SqlConnection conn = new SqlConnection(sets.ConnectionString);

        SqlCommand cmd = new SqlCommand("insert into Users(username,password,Address,Telephone,Email) values ('" + UserName.Text + "','"+Password.Text+"','"+Address.Text+"','"+Telephone.Text+"','"+Email.Text+"')", conn);

        conn.Open();

        cmd.ExecuteNonQuery();

        conn.Close();

        Response.Write("<script>window.alert('添加用户"+UserName.Text+"成功!');</script>");

            }

    protected void Button1_Click(object sender, EventArgs e)

{

Response.Redirect("zxhIndex.aspx");

    }

}

购物主界面的实现代码(shopping.aspx.cs)

public partial class shopping : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

              BindData();

            string username = Session["username"].ToString();

            Label1.Text = username;

            bbsshow();

            }

    ConnectionStringSettings sets = ConfigurationManager.ConnectionStrings["DBConnection"];

    SqlConnection conn;

    protected void bbsshow()

    {

               conn = new SqlConnection(sets.ConnectionString);

        SqlCommand cmd = new SqlCommand("select bbscontent from BBS ", conn);

        conn.Open();

        SqlDataReader reader = cmd.ExecuteReader();

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

基于.NET的网上商城系统的分析与设计 第8页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。