VARKON Version 1.16 1998-10-13


          MACRO MODULE show_price(INT dnr >"Detail number !");

          STRING sql_statement*132,price*10;
          INT    status;

          BEGINMODULE

          !*
          !***Connect to the database.
          !*
             status:=odbc_connect("My_database", "My_name", "My_password");
             if status < 0 then
               exit(odbc_error());
             endif;
          !*
          !***Build SELECT statement.
          !*
             sql_statement:="SELECT price FROM My_table WHERE dnr="+str(dnr,-1,0));
          !*
          !***Execute.
          !*
             status:=odbc_execdirect(sql_statement);
             if status < 0 then
               exit(odbc_error());
             endif;
          !*
          !***Get first line of result.
          !*
             status:=odbc_fetch();
             if status < 0 then
               exit(odbc_error());
             endif;
          !*
          !***Get first data on this line.
          !*
             status:=getstring(price);
             if status < 0 then
               exit(odbc_error());
             endif;
          !*
          !***Close the connection.
          !*
              odbc_disconnect();
          !*
          !***Display result.
          !*
             lst_ini();
             lst_lin("Price is:"+price);
             lst_exi();

          ENDMODULE

Copyright © Microform AB Henningholmsgatan 4  S-703 69 Örebro SWEDEN  E-mail:  info@microform.se

VARKON Homepage Index