c# - Call AS400 CL program from .NET 8 - Stack Overflow

I am converting the following Entity Framework on .NET 4.7.2 code to run on .NET 8.var item = new Form

I am converting the following Entity Framework on .NET 4.7.2 code to run on .NET 8.

var item = new Form
               {
                   TokenId = System.Guid.NewGuid().ToString(),
                   BillForm = "B",
                   CompanyNumber = 5,
                   PolicyNumber = "11111111111"
               };

_formRepository.Add(item);
_formRepository.Execute("Call ProgramLibrary.CLProgram");

.NET 8

var item = new Form
               {
                   TokenId = System.Guid.NewGuid().ToString(),
                   BillForm = "B",
                   CompanyNumber = 5,
                   PolicyNumber = "11111111111"
               };

context._formRepository.Add(item);

var result = context.Database.ExecuteSqlRaw("Call ProgramLibrary.CLProgram");

Connection string:

 "AS400Entities": "server=servername;uid=userid;pwd=pasword;database=databasename;Isolation Level=Chaos;"

I am able to access AS400 tables in .NET 8 and update the data, but the CL program is not being executed. The result is returning -1, which indicates failure.

Do you know what I might be missing?

I am converting the following Entity Framework on .NET 4.7.2 code to run on .NET 8.

var item = new Form
               {
                   TokenId = System.Guid.NewGuid().ToString(),
                   BillForm = "B",
                   CompanyNumber = 5,
                   PolicyNumber = "11111111111"
               };

_formRepository.Add(item);
_formRepository.Execute("Call ProgramLibrary.CLProgram");

.NET 8

var item = new Form
               {
                   TokenId = System.Guid.NewGuid().ToString(),
                   BillForm = "B",
                   CompanyNumber = 5,
                   PolicyNumber = "11111111111"
               };

context._formRepository.Add(item);

var result = context.Database.ExecuteSqlRaw("Call ProgramLibrary.CLProgram");

Connection string:

 "AS400Entities": "server=servername;uid=userid;pwd=pasword;database=databasename;Isolation Level=Chaos;"

I am able to access AS400 tables in .NET 8 and update the data, but the CL program is not being executed. The result is returning -1, which indicates failure.

Do you know what I might be missing?

Share Improve this question edited Mar 11 at 16:17 marc_s 756k184 gold badges1.4k silver badges1.5k bronze badges asked Mar 11 at 14:48 NakresNakres 1,6521 gold badge15 silver badges30 bronze badges 2
  • 1 Are those two lines doing the same thing at all? _formRepository.Execute("Call ProgramLibrary.CLProgram"); vs context.Database.ExecuteSqlRaw("Call ProgramLibrary.CLProgram"); ? Is there some error logged on the db system? – Fildor Commented Mar 11 at 14:59
  • I am assuming that those lines do the same thing, but I am not sure. I do not have access to logs on the db system. – Nakres Commented Mar 11 at 15:01
Add a comment  | 

1 Answer 1

Reset to default 0

SaveChanges was missing. That was the issue. It is now working. Result still returns -1 but it executes the CL program.

   context._formRepository.Add(item);
   context.SaveChanges();
   var result = context.Database.ExecuteSqlRaw("Call ProgramLibrary.CLProgram");

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744787262a4593701.html

相关推荐

  • c# - Call AS400 CL program from .NET 8 - Stack Overflow

    I am converting the following Entity Framework on .NET 4.7.2 code to run on .NET 8.var item = new Form

    10小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信