我将Quickbooks集成到c#以及我在BeginSession中遇到错误
这是我的代码
bool sessionBegun = false;
bool connectionOpen = false;
QBSessionManager sessionManager = null;
try
{
//Create the session Manager object
sessionManager = new QBSessionManager();
//Create the message set request object to hold our request
IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US", 10, 0);
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
BuildCustomerAddRq(requestMsgSet);
//Connect to QuickBooks and begin a session
sessionManager.OpenConnection("", "Sample Code from OSR");
connectionOpen = true;
sessionManager.BeginSession("", ENOpenMode.omDontCare);
sessionBegun = true;
//Send the request and get the response from QuickBooks
IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
//End the session and close the connection to QuickBooks
sessionManager.EndSession();
sessionBegun = false;
sessionManager.CloseConnection();
connectionOpen = false;
WalkCustomerAddRs(responseMsgSet);
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Error");
if (sessionBegun)
{
sessionManager.EndSession();
}
if (connectionOpen)
{
sessionManager.CloseConnection();
}
}
顺便说一句,我只是在此链接enter link description here
中复制此代码这是我的错误
答案 0 :(得分:0)
错误消息告诉您需要将文件名传递给BeginSession调用。