I wish to ask you a suggestion to find the I am making an error.
This bash on a Linux machine works perfectly. Using a command-line utility from MS I can extract some records from another server with SQL-Server.
Code: Select all | Expand
#!/bin/bash
cUser='admin'
cPass='Max61'
cServer='125.15.13.12'
cQuery="SELECT ut codice_cliente, rag nominativo, cf codice_fiscale, piv partita_iva FROM ute WHERE rag like '%MAX%'"
/opt/mssql-tools18/bin/sqlcmd -S $cServer -U $cUser -P $cPass -d BEG_DATI -p -Q "$cQuery" -C
exit 0
Code: Select all | Expand
#require "hbodbc"
***********************************
Function Main()
LOCAL cConnString, hDbc, hStmt, cQuery, cResult, nFetch
REQUEST HB_LANG_IT
HB_LANGSELECT("IT")
REQUEST DBFCDX
REQUEST DBFFPT
RddRegister( "DBFCDX", 1 )
RddSetDefault("DBFCDX")
SET(_SET_AUTORDER,1)
SET AUTOPEN ON
SET DATE BRITISH
SET DELETED ON
SET CENTURY ON
SET EPOCH TO YEAR(DATE())
// Define the ODBC connection string (replace with your actual details)
cConnString := "Driver={ODBC Driver 18 for SQL Server};Server=125.15.13.12;Database=SQL_DATI;UID=admin;PWD=Max61;"
// Initialize the connection handle (hDbc) using SQLConnect
hDbc := SQLConnect( cConnString )
// Check if the connection was successful
IF hDbc == NIL
? "Connection failed!"
RETURN
ENDIF
Return nil
Massimo