updatescore.cs
来自「ASP.NET2.0(C#篇)经典教程的源码...本源码很好的实现了购物车...」· CS 代码 · 共 44 行
CS
44 行
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
[WebService(Namespace = "http://wroxunited.net/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class UpdateScore : System.Web.Services.WebService
{
public void Goal(int FixtureID, int PlayerID, int GoalTime)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["WroxUnited"].ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("usp_Goal", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@FixtureID", SqlDbType.Int).Value = FixtureID;
cmd.Parameters.Add("@PlayerID", SqlDbType.Int).Value = PlayerID;
cmd.Parameters.Add("@GoalTime", SqlDbType.Int).Value = GoalTime;
cmd.ExecuteNonQuery();
}
[WebMethod()]
public void UpdateGoals(int FixtureID, bool GoalFor, int PlayerID, int GoalTime)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["WroxUnited"].ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("usp_UpdateScore", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@FixtureID", SqlDbType.Int).Value = FixtureID;
cmd.Parameters.Add("@GoalFor", SqlDbType.Bit).Value = GoalFor;
cmd.ExecuteNonQuery();
if (GoalFor)
Goal(FixtureID, PlayerID, GoalTime);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?