Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Dot net variables in NAV 2013 R2

Posted on by 205

Using Dot Net variable I am Selecting record from External SQL table (Separate DB), To read a data I used SQLREADER. Once I read the data from SQL I want to update the Boolean field true which is available in External table. How to Achieve " Update Query "  Using Data Adapter, and  how to initialize data adapter using CAL code.

*This post is locked for comments

  • Rashed Profile Picture
    Rashed 3,765 on at
    RE: Dot net variables in NAV 2013 R2

    here is a link with example in cal.  

    mibuso.com/.../using-ado-on-rtc-in-nav

  • Suggested answer
    keoma Profile Picture
    keoma 32,675 on at
    RE: Dot net variables in NAV 2013 R2

    hi

    to update the value you do not need the sqldatareader.

    you need sqlconnection and sqlcommand.

    in c# the code it's like that:

    using (SqlConnection connection = new SqlConnection(

                  connectionString))

       {

           SqlCommand command = new SqlCommand(queryString, connection);

           command.Connection.Open();

           command.ExecuteNonQuery();

       }

    queryString is a string/text variable, e.g. queryString = "update table1 set boolVar=true where id=@id";

    not a big thing to adopt it to c/al.

    you'll find tons of infos and tutorials about that topic.

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!

Community AMA December 12th

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

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,993 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans