C# 为什么ExpenseLineList返回空值
我看到了,我注意到我们有同样的问题,他的问题还没有回答 问题是C# 为什么ExpenseLineList返回空值,c#,quickbooks,qbfc,C#,Quickbooks,Qbfc,我看到了,我注意到我们有同样的问题,他的问题还没有回答 问题是 public class ServiceSel { public void GetCheqe() { bool sessionBegun = false; bool connectionOpen = false; QBSessionManager rp = null; try {
public class ServiceSel
{
public void GetCheqe()
{
bool sessionBegun = false;
bool connectionOpen = false;
QBSessionManager rp = null;
try
{
rp = new QBSessionManager();
IMsgSetRequest requestMsgSet = rp.CreateMsgSetRequest("US", 8, 0);
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
rp.OpenConnection("Database Path File QuickBooks", "QuickBooks Integration Demo");
connectionOpen = true;
rp.BeginSession("", ENOpenMode.omDontCare);
sessionBegun = true;
ICheckQuery checkQuery = requestMsgSet.AppendCheckQueryRq();
IMsgSetResponse msgSetRs = rp.DoRequests(requestMsgSet);
IResponse response = msgSetRs.ResponseList.GetAt(0);
ICheckRetList checkRetList = (ICheckRetList)response.Detail;
if (checkRetList != null)
{
for (int i = 0; i < checkRetList.Count; i++)
{
ICheckRet checkRet = checkRetList.GetAt(i);
//Bank Account On top
string TxnID = checkRet.TxnID.GetValue().ToString(); //Data correct
string TxnNumber = checkRet.TxnNumber.GetValue().ToString(); //Data correct
string Account = checkRet.AccountRef.FullName.GetValue(); //Data correct
string Amount = checkRet.Amount.GetValue().ToString(); //Data correct
if (checkRet.ExpenseLineRetList != null)
{
Error checkRet.Expense Show null Data But in quickbooks have many data expense in calendar
}
}
}
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message, "Error");
}
finally
{
if (sessionBegun)
{
rp.EndSession();
}
if (connectionOpen)
{
rp.CloseConnection();
}
}
}
公共类服务选择
{
public void GetCheqe()
{
bool sessionbegined=false;
bool connectionOpen=false;
QBSessionManager rp=null;
尝试
{
rp=新的QBSessionManager();
IMsgSetRequest requestMsgSet=rp.CreateMsgSetRequest(“美国”,8,0);
requestMsgSet.Attributes.OnError=ENRqOnError.roeContinue;
OpenConnection(“数据库路径文件QuickBooks”,“QuickBooks集成演示”);
connectionOpen=true;
rp.BeginSession(“,ENOpenMode.omDontCare);
sessionbegined=true;
ICheckQuery checkQuery=requestMsgSet.AppendCheckQueryRq();
IMsgSetResponse msgSetRs=rp.DoRequests(requestMsgSet);
IResponse-response=msgSetRs.ResponseList.GetAt(0);
ICheckRetList checkerlist=(ICheckRetList)response.Detail;
if(checkRetList!=null)
{
for(int i=0;i
为什么ExpenseLineList为空?除非您将支票的明细行包括在查询中,否则支票请求将不包括该支票的明细行。通过添加
IncludeLineItems
设置,您可以访问支票的费用或项目列表(支票可以有费用行、项目行或两者都有)。您将要更改以包括以下内容:
ICheckQuery checkQuery = requestMsgSet.AppendCheckQueryRq();
checkQuery.IncludeLineItems.SetValue(true);
IMsgSetResponse msgSetRs = rp.DoRequests(requestMsgSet);
我还建议您在尝试获取响应详细信息之前检查响应代码,以便更好地处理错误:
IResponse response = msgSetRs.ResponseList.GetAt(0);
if(response.StatusCode != 0)
{
// There was an error. response.StatusCode has the error number
// response.StatusMessage has the error description.
}
else
{
ICheckRetList checkRetList = (ICheckRetList)response.Detail;
.
.
.
}
请跟随,看看如何帮助自己。