web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

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

(0) ShareShare
ReportReport
Posted on by 363

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

I have the same question (0)
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    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.

  • Lifeisbelieveful Profile Picture
    363 on at

    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
    237,878 Most Valuable Professional on at

    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());
            }
        }
    }


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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans