MPInterfaceReadDataFromDB Method |
Namespace: MARIInterface
private int lReadPurchaseProcessIDByNumber(string sPurchaseProcessNumber) { string sParam = sPurchaseProcessNumber.Replace("\'", "\'\'"); //replace any ' in the parameter with '' string sSQL = "SELECT [ContractID] FROM [MARIPurchaseProcess] WHERE [POProcessNo]=N'" + sParam + "'"; // MARIProject will translate this MS-SQL style string to the HANA Syntax // SELECT "ContractID" FROM "MARIPurchaseProcess" WHERE "POProcessNo"=N'31123123123' //Use ReadDataFromDB to quickly read a value System.Data.DataTable oTable = oMPInterface.ReadDataFromDB(sSQL); if (oTable.Rows != null || oTable.Rows.Count > 0) { return Convert.ToInt32(oTable.Rows[0]["ContractID"]); } return 0; } private int lReadDocNumFromInvoice(int lDocEntry) { const string SBO_DB_NAME = "SBODEMOUS"; //the access to the SBO database is done indirectly via the MARIProject database connection. // use [] and case sensitive columns to be compatible with HANA databases. string sSQL = $"SELECT [DocNum] FROM {SBO_DB_NAME}.dbo.OINV WHERE [DocEntry]={lDocEntry}"; // MARIProject will translate this MS-SQL style string to the HANA Syntax // SELECT "DocNum" FROM SBODEMOUS.OINV WHERE "DocEntry"=123 //Use ReadDataFromDB to quickly read a value System.Data.DataTable oTable = oMPInterface.ReadDataFromDB(sSQL); if (oTable.Rows != null || oTable.Rows.Count > 0) { return Convert.ToInt32(oTable.Rows[0]["DocNum"]); } return 0; }