Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Code doesn't proceed further anymore after ReaderSelect = CmdSend.ExecuteReader()

Posted on by 345

objConn = new System.Data.OleDb.OleDbConnection(connectStr);
objConn.Open();

CmdSend = objConn.CreateCommand();
CmdUpdateOK = objConn.CreateCommand();
CmdUpdateError = objConn.CreateCommand();

IF (CmdSend)
{
try
{
CmdSend.set_CommandText(strFmt(#LedgerJournalTransSelect, curext()));
ReaderSelect = CmdSend.ExecuteReader();

while(ReaderSelect.Read())
{
_InterfaceNo = strLRTrim(ReaderSelect.GetString(0));

When I run this method, the code doesn't proceed after ReaderSelect = CmdSend.ExecuteReader().

I checked the connection with external database is okay.

Please give me any advice what I should check?

Thanks.

*This post is locked for comments

  • Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: Code doesn't proceed further anymore after ReaderSelect = CmdSend.ExecuteReader()

    Unfortunately I have no idea what you're trying to achieve with your code. I meant something like this:

    System.Exception ex;
    
    try
    {
        ...
    }
    catch (Exception::CLRError)
    {
        ex = ClrInterop::getLastException();
        if (ex != null)
        {
            ex = ex.get_InnerException();
            if (ex != null)
            {
                error(ex.ToString());
            }
        }
    }


  • Lifeisbelieveful Profile Picture
    Lifeisbelieveful 345 on at
    RE: Code doesn't proceed further anymore after ReaderSelect = CmdSend.ExecuteReader()

    Thanks Martin, and sorry for making you confused about version.

    Yes, I'm talking about AX 2012.

    Additionally, I put catch CLR Error like below to update when the codes make exception.

    catch (Exception::CLRError) { CmdUpdateError.set_CommandText(strFmt(ledgerJournalTransErrorUpdate, 'E', this.DateTime(), _InterfaceNo, _GroupNo, _SeqNo, 'exception : CLRError')); }

    But I couldn't get any result for it, because the connection with OLEDB is not constructed. What should I make code to get detail information or break through this problem.

    Thanks.

  • Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: Code doesn't proceed further anymore after ReaderSelect = CmdSend.ExecuteReader()

    I see you selected "current version" as the version tag, which used to be used for D365FO before it got a dedicated forum. Do you mean D365FO (I'll move your question to the right forum) or AX 2012?

    I guess it's AX 2012 and you don't get any details about the exception because you don't catch CLRError exceptions anywhere. Please do it - knowing what problem you have will be a huge step forward.

    By the way, please used the </> button in the rich formatting view to paste source code. It makes code easier to read.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans