web数据库程序设计语言课程设计
OleDbDataReader dr = com.ExecuteReader(); dr.Read(); if (dr.HasRows) {
Response.Write(\language=javascript>alert('恭§喜2您?登?录?成é功|!?');\);
Session[\] = TextName.Text; TextName.Text = \; TextPass.Text = \;
Response.Redirect(\); } else {
Response.Write(\输?入?有瓺误?!?请?重?新?输?入?!?');\);
TextName.Text = \; TextPass.Text = \; TextName.Focus();
} } }
protected void ButtonSearch_Click(object sender, EventArgs e) {
if (DropKey.Text == \书酣?名?\) {
OleDbConnection conn = new OleDbConnection(); conn.ConnectionString = \ + \Source=\ + Server.MapPath(\); conn.Open(); string StrSQL = \ + TextKey.Text + \; OleDbCommand com = new OleDbCommand(StrSQL, conn); OleDbDataReader dr = com.ExecuteReader(); dr.Read(); if (dr.HasRows) {
string name = TextKey.Text + \; Response.Redirect(name); conn.Close();
} else {
Response.Write(\您?所e查é找í的?书酣?不?存?在?!?');\);
25
网上书店信息管理系统
conn.Close();
} } } }
Add.aspx.cs:
using System;
using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;
using System.Web.UI.WebControls; using System.Data; using System.Data.OleDb;
public partial class add : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
this.Title = \添??加?新?书酣?; TextID.Focus(); }
protected void ButtonSubmit_Click(object sender, EventArgs e) {
OleDbConnection conn = new OleDbConnection(); conn.ConnectionString
= \
+
\
Source=\
+
Server.MapPath(\);
string Val = \ + TextID.Text + \ + TextName.Text + \ + TextPublish.Text + \ + TextAuthor.Text + \ + int.Parse(TextPrice.Text)+\+TextClass.Text+\; string
SqlIns
=
\
into
BookLists(BookID,BookName,BookPublish,BookAuthor,BookPrice,BookClass) values(\ + Val + \; OleDbCommand InsCom = new OleDbCommand(SqlIns, conn); OleDbDataAdapter da = new OleDbDataAdapter(); conn.Open();
da.InsertCommand = InsCom; da.InsertCommand.ExecuteNonQuery(); conn.Close();
Response.Write(\language=javascript>alert('添??加?新?书酣?成é功|,?请?单蹋?击?“?返う?回?”a回?到?主?页?面?!?');\); TextID.Text = \; TextID.Focus(); TextName.Text = \; TextPublish.Text = \; TextPrice.Text = \; TextAuthor.Text = \;
26
web数据库程序设计语言课程设计
TextClass.Text = \; }
protected void ButtonBack_Click(object sender, EventArgs e) {
Response.Redirect(\); } }
Add_men.aspx.cs:
using System;
using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;
using System.Web.UI.WebControls; using System.Data; using System.Data.OleDb;
public partial class add : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
this.Title = \添??加?新?会á员a\; TextName.Focus(); }
protected void ButtonSubmit_Click(object sender, EventArgs e) {
OleDbConnection conn = new OleDbConnection(); conn.ConnectionString = \
+
\
Source=\
+
Server.MapPath(\); string Val = \ + TextName.Text + \ + TextPass.Text + \ + TextRealName.Text + \ + TextSex.Text + \ + TextBook1.Text + \ + TextBook2.Text + \ + TextBook3.Text + \; string SqlIns = \into members(MemID,MemPass,MemRealName,MemSex,Book1,Book2,Book3) values(\ + Val + \;
OleDbCommand InsCom = new OleDbCommand(SqlIns, conn); OleDbDataAdapter da = new OleDbDataAdapter(); conn.Open();
da.InsertCommand = InsCom; da.InsertCommand.ExecuteNonQuery(); conn.Close();
Response.Write(\添??加?新?会á员a成é功|,?请?单蹋?击?“?返う?回?”a回?到?主?页?面?!?');\); TextName.Text = \; TextName.Focus(); TextPass.Text = \; TextRealName.Text = \; TextBook1.Text = \;
27
网上书店信息管理系统
TextSex.Text = \; TextBook2.Text = \; TextBook3.Text = \; }
protected void ButtonBack_Click(object sender, EventArgs e) {
Response.Redirect(\); } }
Check.aspx.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;
public partial class Check : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
this.Title = \查é看′购o物?车μ\; if (!IsPostBack) {
string BookList = Session[\].ToString(); ArrayList BookName = new ArrayList(); int Position = BookList.IndexOf(\); while (Position != -1) {
string Book = BookList.Substring(0, Position); if (Book != \) {
BookName.Add(Book);
BookList = BookList.Substring(Position + 1); Position = BookList.IndexOf(\);
} }
CheckSelect.DataSource = BookName; CheckSelect.DataBind();
LabelMsg.Text = \购o物?车μ中D现?有瓺图?书酣?/b>\; }
28
web数据库程序设计语言课程设计
}
protected void LinkFinish_Click(object sender, EventArgs e) {
Response.Redirect(\ + CheckSelect.Items.Count.ToString()); }
protected void ButtonDel_Click1(object sender, EventArgs e) {
Session[\] = null;
ArrayList BookName = new ArrayList();
for (int i = 0; i < CheckSelect.Items.Count; i++) {
if (!CheckSelect.Items[i].Selected) {
BookName.Add(CheckSelect.Items[i].Text); Session[\] = Session[\] + CheckSelect.Items[i].Text + \; }
}
CheckSelect.DataSource = BookName; CheckSelect.DataBind(); }
protected void ButtonClear_Click1(object sender, EventArgs e) {
Session[\] = null;
Response.Redirect(\); } }
Del.aspx.cs: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;
using System.Web.UI.WebControls; using System.Data; using System.Data.OleDb;
public partial class del : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
29