How to Create a New record in ReqLog

Dear All,

Am trying to insert new record in ReqLog Table. kindly guide me what is the best practice to to that.

As a one time thing or what?

What are you doing? A UBAQ can do it. The BO is Erp.Req.

Am tring to insert new record using the below code, but it’s giving an error that “This Row Already belongs to another table”

Erp.BO.ReqLogDataSet.ReqLogDataTable reqLogDataTable = new Erp.BO.ReqLogDataSet.ReqLogDataTable();

Erp.BO.ReqLogDataSet.ReqLogRow reqLogRow = reqLogDataTable.AddReqLogRow(
    "EPIC01",
    7,
    "R004",
    "Mohamed.Haikal",
    "Syed.Ibrahim",
    DateTime.Now,
    32049,
    true,
    "",
    "A",
    true,
    "P",
    0x00000000005E6138,
    Guid.NewGuid(),
    "Approval From IT Manager",
    "",
    "Pending",
    "32049",
    1,
    "Syed.Ibrahim",
    "Mohamed Haikal",
    "Approval From IT Manager",
    "",
    "",
    "A");

adapterReq.ReqLogData.ReqLog.NewReqLogRow();
adapterReq.ReqLogData.ReqLog.AddReqLogRow(reqLogRow);

I fixed your formatting.

You can format your own code by wrapping your code in backticks (graves) like this:
```
Code Goes Here.
```

If you add cs to the first ```, like:
```cs
Code Goes Here.
```
You can make sure the syntax highlighting is for C#

Here is what you did:

//You made a table
Erp.BO.ReqLogDataSet.ReqLogDataTable reqLogDataTable = new Erp.BO.ReqLogDataSet.ReqLogDataTable();

//You made a row, and ADDED it to the table in one shot
Erp.BO.ReqLogDataSet.ReqLogRow reqLogRow = reqLogDataTable.AddReqLogRow(
    "EPIC01",
    7,
    "R004",
    "Mohamed.Haikal",
    "Syed.Ibrahim",
    DateTime.Now,
    32049,
    true,
    "",
    "A",
    true,
    "P",
    0x00000000005E6138,
    Guid.NewGuid(),
    "Approval From IT Manager",
    "",
    "Pending",
    "32049",
    1,
    "Syed.Ibrahim",
    "Mohamed Haikal",
    "Approval From IT Manager",
    "",
    "",
    "A");

//This makes a new row in the adapter, but you did nothing with it
adapterReq.ReqLogData.ReqLog.NewReqLogRow();

//You tried to add the row you made up top, to the adapters reqlog table, but this row
//has already been added to the table "reqLogDataTable"
adapterReq.ReqLogData.ReqLog.AddReqLogRow(reqLogRow);

Off the cuff, but try something more along these lines:


//You can leave off the -> "Erp.BO.ReqLogDataSet.ReqLogRow reqLogRow = "
//if you don't need to access the row after
Erp.BO.ReqLogDataSet.ReqLogRow reqLogRow = adapterReq.ReqLogData.ReqLog.AddReqLogRow(
    "Your fields here");

Erp.BO.ReqLogDataSet.ReqLogRow reqLogRow = adapterReq.ReqLogData.ReqLog.AddReqLogRow(“EPIC01”,
7,
“R004”,
“Mohamed.Haikal”,
“Syed.Ibrahim”,
DateTime.Now,
32049,
true,
“”,
“A”,
true,
“P”,
Convert.ToInt64(DateTime.Now.Ticks),
Guid.NewGuid(),
“Approval From IT Manager”,
“”,
“Pending”,
“32049”,
1,
“Syed.Ibrahim”,
“Mohamed Haikal”,
“Approval From IT Manager”,
“”,
“”,
“A”);

I have modified the code as per your suggusstion, but still the row not insterted.

Did you call update?

That code I gave replaces the entirety of the code you posted.

App.ReqEntry.ReqEntryForm_Customization_AJG_Cust_SW_POReq_V1.0_CustomExport.xml (32.3 KB)

Yes, i have called the update.
@hkeric.wci @klincecum

@klincecum , any Update ?