当前位置:编程学习 > C#/ASP.NET >>

高手门 给我支招吧 快来帮忙解决下吧

一个保存  出现的错误:
private void SaveSheet(string workingTag)
{

TimeStamp ts = null;
LoggingStart(ref ts);

int nRst;
string strWorkingTag ="";

int ResultNo = 0;


string[] strParams = null;


string strCommandText = " ";

SqlParameter[] arrParams = null;

try
{
using(oDBMgrTx = new LDCC.CBS.FrameWork.Standard.DBManagerTx())
{
arrParams = new SqlParameter[10]; 
strParams = new string[dgrMenuLevel2.Columns.Count];

string strSP = "up_HBgtTotGuanliDtl_s1";


for(int i = 0; i < dgrMenuLevel2.Rows.Count; i++) 
{
strParams = new string[dgrMenuLevel2.Columns.Count];



for(int j = 0; j < dgrMenuLevel2.Columns.Count; j++)
{
if( dgrMenuLevel2.Rows[i].Cells[j].Value == null )
strParams[j] = null;
else
strParams[j] = dgrMenuLevel2.Rows[i].Cells[j].Value.ToString();
}

if( workingTag.Equals(SLVL2) ) 
{

if(strParams[0] == null) continue; 
else if(strParams[0] == LDCC.CBS.FrameWork.Web.Control.GridControl.InsertedRow) strWorkingTag = I;
else if(strParams[0] == LDCC.CBS.FrameWork.Web.Control.GridControl.UpdatedRow) strWorkingTag = U;
}


arrParams[0] = oDBMgrTx.SetSqlParameter("@WorkingTag", strWorkingTag, ParameterDirection.Input, SqlDbType.Char);
arrParams[1] = oDBMgrTx.SetSqlParameter("@ActYm", strMonth.Replace("-",""), ParameterDirection.Input, SqlDbType.Char);
arrParams[2] = oDBMgrTx.SetSqlParameter("@PC_Dept_ID", "13" , ParameterDirection.Input, SqlDbType.Int );
arrParams[3] = oDBMgrTx.SetSqlParameter("@ProductLine", strParams[2] , ParameterDirection.Input, SqlDbType.Int );
arrParams[4] = oDBMgrTx.SetSqlParameter("@SI_Dept_ID", strParams[3] , ParameterDirection.Input, SqlDbType.Int );
arrParams[5] = oDBMgrTx.SetSqlParameter("@CostType",  strParams[4] , ParameterDirection.Input, SqlDbType.VarChar );
arrParams[6] = oDBMgrTx.SetSqlParameter("@Cost", strParams[7] , ParameterDirection.Input, SqlDbType.Decimal );
arrParams[7] = oDBMgrTx.SetSqlParameter("@MKTCost", strParams[8] , ParameterDirection.Input, SqlDbType.Decimal );
arrParams[8] = oDBMgrTx.SetSqlParameter("@KACost", strParams[9] , ParameterDirection.Input, SqlDbType.Decimal );
arrParams[9] = oDBMgrTx.SetSqlParameter("@CREATEDBY", UserInfo.LoginID, ParameterDirection.Input, SqlDbType.VarChar );


nRst = oDBMgrTx.ExecuteCommand(strSP, arrParams);

nEffectCount++;


informationMessage = "保存及处理正常";
}
}
catch(Exception ex)
{
errorMessage = ex.Message; 
}
finally
{
strParams = null;
arrParams = null;

// Time Stamp & Logging End
LoggingEnd(ts,this,MethodInfo.GetCurrentMethod().Name);
}
}



#endregion
}
}





错误提示是这样的:
object reference not set to an instance of an object

--------------------编程问答-------------------- --------------------编程问答-------------------- 你不知道如何找到指定的错误点吗 ? --------------------编程问答-------------------- 错误应该在
arrParams[0]
     |
arrParams[9]之间  但是 实在是找不出来 哪里有问题 一会没 错误 一会 出错的  实在是 不知道 哪里出问题了
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,