异常详细信息: System.NullReferenceException的问题

lanxing106 lanxing106 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
怎么样做才可以不出这个异常,我是菜鸟,帮忙看一下
using System;
using System.Data;
using System.Configuration;
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;
using System.Collections;

/// <summary>
/// Util 的摘要说明
/// </summary>
public class Util
{

private static ArrayList valueList = new ArrayList();
private static ArrayList countList = new ArrayList();

public Util()
{
//
// TODO: 在此处添加构造函数逻辑
//
}


//返回二维数组,供曲线图调用
public static string[][] readBgValueArray()
{
int arraySize=bgValueCount();
string[][] str = new string[arraySize][];
for (int i = 0; i < str.Length; i++)
{
str[i][0] = Convert.ToString(Math.Round((double)valueList[i],2));
str[i][1] = Convert.ToString(Math.Round((double)countList[i],2));
}

return str;
}

//计算正数存储大小
public static int bgValueZCount()
{
string value = "";
int j = 0;
int count = 0;
double d = 0.01;
while ( d <= 1)
{
value= Convert.ToString(Math.Round(d,2));
j = DBCommand.readBackGroundValueCount(value);
if (j > 0)
{
valueList.Add(d);
countList.Add(j);
count++;
}
d += 0.01;
}
return count;
}

//计算负数数存储大小
public static int bgValueFCount()
{
string value = "";
int j = 0;
int count = 0;
double d = -0.01;
while (d >= -1)
{
value = Convert.ToString(Math.Round(d, 2));
j = DBCommand.readBackGroundValueCount(value);
if (j > 0)
{
valueList.Add(d);
countList.Add(j);
count++;
}
d += -0.01;
}
return count;
}

//计算NULL存储大小
public static bool bgValueNullCount()
{
bool flag=false;
int count= DBCommand.readBackGroundValueCount("NULL");
if (count > 0)
{
valueList.Add("NULL");
countList.Add(count);
flag = true;
}
return flag;
}

//计算比值个数
public static int bgValueCount()
{
int zCount = bgValueZCount();
int fCount = bgValueFCount();
int nullCount = 0;
if (bgValueNullCount())
{
nullCount = 1;
}

return zCount + fCount + nullCount;
}
}
...全文

相关推荐

评论 8
收藏 已收藏
分享
返回顶部
lanxing106
C# 111,128 成员 642,537 内容