我是C Sharp编程新手。我收到了错误。
Script Component在用户代码中遇到异常:Object 引用未设置为对象的实例。在 ScriptMain.Input0_ProcessInputRow(Input0Buffer Row)at UserComponent.Input0_ProcessInput(Input0Buffer Buffer)at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(的Int32 inputID,PipelineBuffer buffer)
这是我的代码如下
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using Microsoft.SqlServer.Dts.Runtime;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
int iEx = 0;
int iPr = 0;
int iPa = 0;
int iSch = 0;
int iTim=0;
int iTime = 0;
int tryCount=1;
SC_819162ba1fcf40f686f8181327002472.csproj.WebReference.Service s = new SC_819162ba1fcf40f686f8181327002472.csproj.WebReference.Service();
SC_819162ba1fcf40f686f8181327002472.csproj.WebReference.LicenseUsage[] l = SC_819162ba1fcf40f686f8181327002472.csproj.WebReference.LicenseUsage[10];
l =null;
while (tryCount<=3)
{
try
{ l = s.GetProductPeakUsage(Row.salesforceidstring, Row.StartDatestring, Row.EndDatestring);
break;
}
catch (Exception e)
{
tryCount = tryCount + 1;
if (tryCount > 3)
{
bool pbCancel = false;
this.ComponentMetaData.FireError(9999, "Error-Failed the 3rd time", e.ToString(), "", 0, out pbCancel);
}
}
}
for (int i = 0; i < l.Length; i++)
{
if (l[i].Product == SC_819162ba1fcf40f686f8181327002472.csproj.WebReference.Product.Pr)
iPr = l[i].ActiveSeats;
if (l[i].Product == SC_819162ba1fcf40f686f8181327002472.csproj.WebReference.Product.Sch)
iSch = l[i].ActiveSeats;
if (l[i].Product == SC_819162ba1fcf40f686f8181327002472.csproj.WebReference.Product.Pa)
iPa = l[i].ActiveSeats;
if (l[i].Product == SC_819162ba1fcf40f686f8181327002472.csproj.WebReference.Product.Ex)
iEx = l[i].ActiveSeats;
if (l[i].Product == SC_819162ba1fcf40f686f8181327002472.csproj.WebReference.Product.Time)
iTime = l[i].ActiveSeats;
if (l[i].Product == SC_819162ba1fcf40f686f8181327002472.csproj.WebReference.Product.Tim)
iTim = l[i].ActiveSeats;
}
Row.Ex = iEx;
Row.Pr = iPr;
Row.Sch = iSch;
Row.Pa = iPa;
Row.Time = iTime;
Row.Tim=iTim;
}
}
有人可以帮我怎么调试这个?我知道我的输入值为空值。如何绕过此逻辑中的空值