Not able to create Sales Orders in Sage 100 using BOI

I have written a code to create sales orders from my c# code.But when i set customerNo$,it always fails and returns '0'.

Here is my Code

namespace SageSalesOrder
{
class Program
{
public static string successCheck(int checkValue, string call)
{
string message = "";
if (checkValue == 0)
{
message = call.ToString();

}
return message;
}
static void Main(string[] args)
{
string mas90 = @"C:\Sage\Sage 100 Premium\MAS90\Home";
string compCode = "122";
string accDate = DateTime.Now.ToString("yyyyMMdd");

//new way
object pvx = null;
object oSS = null;
object oSOB = null;
object oSOL = null;
object retVal = null;


using (DispatchObject pvx1 = new DispatchObject("ProvideX.Script"))
{
// Replace the text "*PATH TO MAS90\HOME*" with the correct MAS90\Home path in the line below
pvx1.InvokeMethod("Init", mas90);

// Instantiate a new Session object and initialize the session
// by setting the user, company, date and module
using (DispatchObject oSS1 = new DispatchObject(pvx1.InvokeMethod("NewObject", "SY_Session")))
{
oSS1.InvokeMethod("nLogon");
oSS1.InvokeMethod("nSetUser", new object[] { "vivek", "welcome@123" });
oSS1.InvokeMethod("nSetCompany", compCode);
oSS1.InvokeMethod("nSetDate", "S/O", accDate);
oSS1.InvokeMethod("nSetModule", "S/O");

// Get the Task ID for the AR_Customer_ui program
int TaskID = (int) oSS1.InvokeMethod("nLookupTask", "SO_SalesOrder_ui");
oSS1.InvokeMethod("nSetProgram", TaskID);


using (DispatchObject so_order = new DispatchObject(pvx1.InvokeMethod("NewObject", "SO_SalesOrder_bus", oSS1.GetObject())))
{
string strSalesOrderNo = "";
object[] arrResults = new object[] { strSalesOrderNo };
retVal = so_order.InvokeMethodByRef("nGetNextSalesOrderNo", arrResults);
strSalesOrderNo = arrResults[0].ToString();

// Add items to the header

successCheck((int) so_order.InvokeMethod("nSetKey", "45454"), "SetKey");
// successCheck((int) so_order.InvokeMethod("nSetValue", "ARDivisionNo$", "01"), "SetValue");
retVal = so_order.InvokeMethod("nSetValue", "CustomerNo$", "001");
retVal = so_order.InvokeMethod("nSetValue", "TaxSchedule$", "DEFAULT");

// Add a line
retVal = so_order.InvokeMethod("nAddLine");

using (DispatchObject oLines = new DispatchObject(so_order.GetProperty("oLines")))
{
retVal = oLines.InvokeMethod("nSetValue", "ItemCode$", "/801201");
retVal = oLines.InvokeMethod("nSetValue", "ItemType$", "2");
retVal = oLines.InvokeMethod("nSetValue", "QuantityOrdered", "1.0");
// retVal = oLines.InvokeMethod("nSetValue", "ItemCostAccount$", "320");
// retVal = oLines.InvokeMethod("nSetValue", "SalesAccount$", "320");
retVal = oLines.InvokeMethod("nWrite");
}
//Write the order
retVal = so_order.InvokeMethod("nWrite");
}
}

}

}
}
}