- 分享
- 0
- 人气
- 0
- 主题
- 13
- 帖子
- 57
- UID
- 296844
- 积分
- 1577
- 阅读权限
- 19
- 注册时间
- 2010-1-29
- 最后登录
- 2016-6-16
- 在线时间
- 424 小时
        
|
public partial class Inventory_ABCAnalysis : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string testing(int i)
{
SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["connString"]);
string sql = "SELECT COUNT[sellingcost] AS total FROM [Item]";
SqlCommand cmd = new SqlCommand(sql, conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
cmd.CommandType = CommandType.Text;
da.Fill(ds, "Item");
dt = ds.Tables["Item"];
string category;
int total;
total = 100 / dt.Rows[0]["total"];
if (total * i <= 20)
category = "A";
else if (total * i <= 50)
category = "B";
else if (total * i <= 100)
category = "C";
return category;
}
}
当我run时,出现以下错误。
Error: Operator '/' cannot be applied to operands of type 'int' and 'object'
由于我一直不能解决这问题,所以才请问各位帮帮忙了,在此感激不尽! |
|