Hi,
At PowerBuilder side, I am able to get two DWs with all (existing + modified)data in ls_json using JSON Package, at API side I am using DataPacker and DataUnpacker, I have tried using Update() and SaveChanges() to save data of both .NET datastores- unable to Save changes in database.
When I debug the code both Datastores[one for each DW] at WEB API level comes with Column names only, no data exists.
Any suggestion on "how to" at API side,
1. I can retrieve all (existing + modified) data in SnapDevelop WEB API?
2. Data gets saved in database successfully in WEB API?
I am using below Code snippet in WEB API:
public void UpdateAll()
{
var dataStore1 = new DataStore("DW_1", _dataContext);
var dataStore2 = new DataStore("DW_2", _dataContext);
var dataPacker = new DataPacker();
var key1 = nameof(dataStore1);
var key2 = nameof(dataStore2);
dataPacker.AddDataStore(key1, dataStore1, true);
dataPacker.AddDataStore(key2, dataStore2, true);
string text = dataPacker.GetTextString(DataFormat.Json);
var dataUnpacker = new DataUnpacker(text, DataFormat.Json);
// Gets the DataStore object from dataUnPacker according to the key.
var ds1 = dataUnpacker.GetDataStore(key1,_dataContext);
var ds2 = dataUnpacker.GetDataStore(key2, _dataContext);
//ds1.SaveChanges();
try
{
_dataContext.BeginTransaction();
// ds1.Update();
// ds2.Update();
ds1.SaveChanges(_dataContext);
ds2.SaveChanges(_dataContext);
}
catch (Exception)
{
_dataContext.Rollback();
}
}
Thanks!
https://community.appeon.com/index.php/qna/q-a/getting-error-in-controller-code-system-argumentnullexception-value-cannot-be-null-parameter-name#reply-38461