Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Binary data to container conversion

(0) ShareShare
ReportReport
Posted on by

Hi, i need to  read binary data from sql server( a container column from a table) and assign to a container variable, how it's possible to do that?

Thank you

Eddy

*This post is locked for comments

  • RE: Binary data to container conversion

    there is a solution to cast the value retrieve from datareader to a container?

    Thank you

  • RE: Binary data to container conversion

    yeah the design it's the big problem, but it'snot possible to change ...:( so i need an alternative solution...

  • Martin Dráb Profile Picture
    Martin Dráb 231,407 Most Valuable Professional on at
    RE: Binary data to container conversion

    By the way, what kind of binary data do you store there and why do you fetch million records with such fields? Isn't the core problem in database schema design?

  • Martin Dráb Profile Picture
    Martin Dráb 231,407 Most Valuable Professional on at
    RE: Binary data to container conversion

    Can you please show the two queries and compare their execution plans? That will reveal where these two things differ and (hopefully) you should be able to update what you do in AX to achieve the same performance.

  • RE: Binary data to container conversion

    In my specific case (million record and container\memo fields)

  • RE: Binary data to container conversion

    Hi Martin ,

    i don't think it's same thing, run the while select from Ax it's much more  "expensive" than run  a query and  after using a while with  Datareader (in memory).

    Thank you

    Eddy

  • Martin Dráb Profile Picture
    Martin Dráb 231,407 Most Valuable Professional on at
    RE: Binary data to container conversion

    Oh, that's a wrong approach. If you run the same query, you'll get the same performance, and you'll waste time to develop code that isn't needed and will be difficult to maintain.

    I suggest you stop coding and and rather look at the performance problem. Tell us more about it if you need help.

  • RE: Binary data to container conversion

    Yes the field is a container type  and is on sql database is varbinary (AX db)

    I must use directly db connection with datareader because while select it's too slow...but i'm not able to cast container variable from sqldatareader.get()....

    It's possible to do that with other API?

    Thank you

  • Martin Dráb Profile Picture
    Martin Dráb 231,407 Most Valuable Professional on at
    RE: Binary data to container conversion

    Then the data type isn't container, because SQL server doesn't have such a type, right? Or do you mean by that that the SQL field is actually a part of AX database? If so, why do you use a direct query?

    Am I right in assuming that datareader is an instance of .NET class SqlDataReader? (It will help if you give us more information and don't let us guessing.)

    By the way, I avoid SqlDataReader; there are much better APIs that can generate strongly-typed data model from the database schema and make your development much easier and safer.

  • RE: Binary data to container conversion

    I read binary data via ado connection and i want assign to a container value

    Es.

    Container con = datareader.GET....

    it'spossible to do that?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans