vs2008编写的一个web简单问题,新手求解
using System;
/// <summary>
///Account 的摘要说明
/// </summary>
public class Account
{
private string _ID;
private string _Name;
private decimal _Balance;
public Account(string id,string name,decimal balance)
{
this.ID = id;
this.Name = name;
this.Balance = balance;
//
//TODO: 在此处添加构造函数逻辑
//
}
public string ID
{
get
{
return this._ID;
}
set
{
this._ID = value;
}
}
public string Name
{
get
{
return this._Name;
}
set
{
this._Name = value;
}
}
public decimal Balance
{
get
{
return this._Balance;
}
set
{
this._Balance = value;
}
}
///<summary>
///存款方法
///</summary>
public void Deposit(decimal amount)
{
if (amount > 0)
{
this._Balance += amount;
}
else
{
throw new Exception("存款金额不能小于或等于0!");
}
}
///<summary>
///取款方法
///</summary>
public void Acquire(decimal amount)
{
if (amount < this._Balance)
{
this._Balance -= amount;
}
else
{
throw new Exception("余额不足!");
}
}
}
以上是类Account.cs的定义
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Account : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//建立account对象
Account account = new Account("03401","李明", 200);
//输出初始余额信息
Response.Write("初始余额为:" + account.Balance.ToString()+"<br/>");
//存款100
account.Deposit(100);
//输出存款100余额信息
Response.Write(account.Name + "的存款余额为:" + account.Balance.ToString() + "<br/>");
//取款150
account.Acquire(150);
//输出取款150余额信息
Response.Write("取款150后" + "<br/>");
Response.Write(account.Name + "的存款余额为:" + account.Balance.ToString());
}
}
以上是Account.aspx.cs的定义

文件就这些,Account.aspx文件没改过,但是编译一大堆错误,我想是Account.aspx.cs文件可能没有跟类文件关联起来。
/// <summary>
///Account 的摘要说明
/// </summary>
public class Account
{
private string _ID;
private string _Name;
private decimal _Balance;
public Account(string id,string name,decimal balance)
{
this.ID = id;
this.Name = name;
this.Balance = balance;
//
//TODO: 在此处添加构造函数逻辑
//
}
public string ID
{
get
{
return this._ID;
}
set
{
this._ID = value;
}
}
public string Name
{
get
{
return this._Name;
}
set
{
this._Name = value;
}
}
public decimal Balance
{
get
{
return this._Balance;
}
set
{
this._Balance = value;
}
}
///<summary>
///存款方法
///</summary>
public void Deposit(decimal amount)
{
if (amount > 0)
{
this._Balance += amount;
}
else
{
throw new Exception("存款金额不能小于或等于0!");
}
}
///<summary>
///取款方法
///</summary>
public void Acquire(decimal amount)
{
if (amount < this._Balance)
{
this._Balance -= amount;
}
else
{
throw new Exception("余额不足!");
}
}
}
以上是类Account.cs的定义
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Account : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//建立account对象
Account account = new Account("03401","李明", 200);
//输出初始余额信息
Response.Write("初始余额为:" + account.Balance.ToString()+"<br/>");
//存款100
account.Deposit(100);
//输出存款100余额信息
Response.Write(account.Name + "的存款余额为:" + account.Balance.ToString() + "<br/>");
//取款150
account.Acquire(150);
//输出取款150余额信息
Response.Write("取款150后" + "<br/>");
Response.Write(account.Name + "的存款余额为:" + account.Balance.ToString());
}
}
以上是Account.aspx.cs的定义

文件就这些,Account.aspx文件没改过,但是编译一大堆错误,我想是Account.aspx.cs文件可能没有跟类文件关联起来。
...全文
相关推荐
VS 2008 Web service 简单实例
VS 2008 Web service 简单实例,包括webservice和app应用, TestWebService为服务,TestWebApp为简单应用。
关于使用VS2008(只合适新手)
上次传过了一次,由于我大意,保存的是.docx后缀,搞得一些用word2003的朋友打不开。这次重新保持了,是.doc后缀,放心下载。本资料只适合新手,截图比较多,不要嫌啰嗦了呵呵。
VS2008新建、发布、调用Web服务
VS2008新建、发布、调用Web服务VS2008新建、发布、调用Web服务VS2008新建、发布、调用Web服务VS2008新建、发布、调用Web服务
VS2008调试问题补丁
该补丁解决了VS.NET2008附加到进程调试WEB网页时,不能一步步跟踪代码调试的问题.
VS2008 Web创作组件安装失败的解决办法
VS2008 Web创作组件安装失败的解决办法


