我自己做的 按照老师的要求 可以购物 界面做的还可以 下载下来之后直接解压 内涵数据库 直接就可以用了
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-12-22 03:00 我的购物车
目录 0 2011-12-22 03:00 我的购物车Data
文件 3145728 2011-12-22 03:00 我的购物车Datashopping.mdf
文件 1048576 2011-12-22 03:00 我的购物车Datashopping_log.ldf
目录 0 2011-12-18 15:14 我的购物车paid
目录 0 2011-12-18 15:14 我的购物车paidApp_Code
文件 2554 2011-12-06 20:19 我的购物车paidApp_CodeService.cs
目录 0 2012-01-20 01:37 我的购物车paidApp_Data
文件 87 2008-01-11 20:32 我的购物车paidService.asmx
文件 8068 2011-12-05 10:26 我的购物车paidweb.config
目录 0 2011-12-24 20:44 我的购物车shop
目录 0 2011-12-18 14:50 我的购物车shopApp_Code
文件 998 2011-11-20 13:29 我的购物车shopApp_CodeGoods.cs
文件 1403 2011-11-20 19:19 我的购物车shopApp_CodeOperateDatabase.cs
目录 0 2011-12-18 14:50 我的购物车shopApp_WebReferences
目录 0 2011-12-18 14:50 我的购物车shopApp_WebReferenceslocalhost
文件 707 2011-12-06 20:02 我的购物车shopApp_WebReferenceslocalhostService.disco
文件 578 2011-12-06 20:02 我的购物车shopApp_WebReferenceslocalhostService.discomap
文件 2955 2011-12-06 20:02 我的购物车shopApp_WebReferenceslocalhostService.wsdl
文件 595 2011-12-24 20:44 我的购物车shopDefault.aspx
文件 679 2011-12-24 20:44 我的购物车shopDefault.aspx.cs
文件 940 2011-11-23 08:11 我的购物车shopGlobal.asax
文件 7112 2011-11-22 21:50 我的购物车shopTshirt.aspx
文件 6240 2011-11-23 08:41 我的购物车shopTshirt.aspx.cs
文件 8024 2011-12-06 20:02 我的购物车shopWeb.Config
文件 7453 2011-12-05 10:38 我的购物车shopcar.aspx
文件 5008 2011-12-06 20:11 我的购物车shopcar.aspx.cs
文件 7110 2011-11-22 21:46 我的购物车shopcoat.aspx
文件 6238 2011-11-23 08:41 我的购物车shopcoat.aspx.cs
文件 7109 2011-11-22 21:49 我的购物车shophat.aspx
文件 6236 2011-11-23 08:41 我的购物车shophat.aspx.cs
............此处省略89个文件信息
using System;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.xml.Linq;
using System.Data.SqlClient;
[WebService(Namespace = “http://tempuri.org/“)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
// [System.Web.script.Services.scriptService]
public class Service : System.Web.Services.WebService
{
public Service()
{
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
[WebMethod]
public int pay(string userID int Money)
{
if (giveMoney(userID Money) == 0)
{
return 0;
}
else
{
return getMoney((Money));
}
}
public int giveMoney(string userID int Money)
{
int money = 0;
SqlConnection con = new SqlConnection(“server=WTJ-PC\SQLEXPRESS;database=shop;uid=sa;password=123“);
con.Open();
string sql = “select * from users where userID=‘“ + userID + “‘“;
SqlCommand sqlCmd = new SqlCommand(sql con);
SqlDataReader dr = sqlCmd.ExecuteReader();
if (dr.Read())
{
money=int.Parse(dr[“money“].ToString());
}
con.Close();
if (money <= Money || money <= 0)
{
return 0;
}
else
{
money -= Money;
}
con.Open();
sql = “update users set money=‘“ + money + “‘ where userID=‘“ + userID + “‘“;
sqlCmd = new SqlCommand(sql con);
sqlCmd.ExecuteNonQuery();
con.Close();
return 1;
}
public int getMoney(int Money)
{
int money = 0;
SqlConnection con = new SqlConnection(“server=WTJ-PC\SQLEXPRESS;database=shop;uid=sa;password=123“);
con.Open();
string sql = “select * from users where userID=‘456‘“;
SqlCommand sqlCmd = new SqlCommand(sql con);
SqlDataReader dr = sqlCmd.ExecuteReader();
if (dr.Read())
{
money = int.Parse(dr[“money“].ToString());
}
con.Close();
money += Money;
con.Open();
sql = “update users set money=‘“ + money + “‘ where userID=‘456‘“;
sqlCmd = new SqlCommand(sql con);
sqlCmd.ExecuteNonQuery();
con.Close();
return 1;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-12-22 03:00 我的购物车
目录 0 2011-12-22 03:00 我的购物车Data
文件 3145728 2011-12-22 03:00 我的购物车Datashopping.mdf
文件 1048576 2011-12-22 03:00 我的购物车Datashopping_log.ldf
目录 0 2011-12-18 15:14 我的购物车paid
目录 0 2011-12-18 15:14 我的购物车paidApp_Code
文件 2554 2011-12-06 20:19 我的购物车paidApp_CodeService.cs
目录 0 2012-01-20 01:37 我的购物车paidApp_Data
文件 87 2008-01-11 20:32 我的购物车paidService.asmx
文件 8068 2011-12-05 10:26 我的购物车paidweb.config
目录 0 2011-12-24 20:44 我的购物车shop
目录 0 2011-12-18 14:50 我的购物车shopApp_Code
文件 998 2011-11-20 13:29 我的购物车shopApp_CodeGoods.cs
文件 1403 2011-11-20 19:19 我的购物车shopApp_CodeOperateDataba
目录 0 2011-12-18 14:50 我的购物车shopApp_WebReferences
目录 0 2011-12-18 14:50 我的购物车shopApp_WebReferenceslocalhost
文件 707 2011-12-06 20:02 我的购物车shopApp_WebReferenceslocalhostService.disco
文件 578 2011-12-06 20:02 我的购物车shopApp_WebReferenceslocalhostService.discomap
文件 2955 2011-12-06 20:02 我的购物车shopApp_WebReferenceslocalhostService.wsdl
文件 595 2011-12-24 20:44 我的购物车shopDefault.aspx
文件 679 2011-12-24 20:44 我的购物车shopDefault.aspx.cs
文件 940 2011-11-23 08:11 我的购物车shopGlobal.asax
文件 7112 2011-11-22 21:50 我的购物车shopTshirt.aspx
文件 6240 2011-11-23 08:41 我的购物车shopTshirt.aspx.cs
文件 8024 2011-12-06 20:02 我的购物车shopWeb.Config
文件 7453 2011-12-05 10:38 我的购物车shopcar.aspx
文件 5008 2011-12-06 20:11 我的购物车shopcar.aspx.cs
文件 7110 2011-11-22 21:46 我的购物车shopcoat.aspx
文件 6238 2011-11-23 08:41 我的购物车shopcoat.aspx.cs
文件 7109 2011-11-22 21:49 我的购物车shophat.aspx
文件 6236 2011-11-23 08:41 我的购物车shophat.aspx.cs
............此处省略89个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)