Connecting Navision using ADO SQL Query Parameter.

Dev1978Dev1978 Member Posts: 18
I am trying to connect the local client to SQL Server database using the ADO functionality. It is working proper. But my question is that how can i like a parameter to the query.

nm :='JOHN';
SQLString := ' SELECT * FROM [MSRETAIL].[dbo].[MS Retail$CUSTOMER] ' +
' WHERE [NAME] = ' + nm ;

I have declared the nm as a text parameter in global variables.

When i run the code it gives me error 'invalid column name JOHN';

How to link the parameters to the query.

Comments

  • jupjup Member Posts: 7
    Hi,
    try this:

    SQLString := ' SELECT * FROM [MSRETAIL].[dbo].[MS Retail$CUSTOMER] ' +
    ' WHERE [NAME] = ''' + nm + '''';
    -- Jup --
  • bbrownbbrown Member Posts: 3,268
    Use "ADOCommand.CreateParameter" and "ADOCommand.Parameters.Append"
    There are no bugs - only undocumented features.
  • Dev1978Dev1978 Member Posts: 18
    Thanks jup it is working....

    Now how to display the decimal values using ADO in navision?
  • ara3nara3n Member Posts: 9,256
    in your sql statement you need add cast to a float and then in nav you can receive into a decimal datatype.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.