Page 2 of 3
Re: mssql server 2012 express
Posted: Wed Apr 17, 2019 11:28 pm
by jairpinho
jorge.posadas wrote: ↑Wed Apr 17, 2019 3:11 pm
jairpinho
This an example I hope help you
Gracias Jorge, funcionó perfectamente sin odbc conexión nativa sigue el ejemplo para todos. espero recibir más ejemplos para otros tipos de conexión rdd o odbc para dejar como exeomplo para el grupo
english
Thanks Jorge, worked perfectly without odbc native connection follows example for all. I hope to receive more examples for other types of connection rdd or odbc to leave as exeomplo for the group
Re: mssql server 2012 express
Posted: Thu Apr 18, 2019 4:24 pm
by mol
Thanks guys
Re: mssql server 2012 express
Posted: Wed Sep 04, 2019 3:50 am
by Tiger
Hi jairpinho,
Thanks for your sample "AD0_NATIVE.zip ", it helps me to connect to the MSSQL now. And I just wonder how to export the query result to excel file. Can anyone guide me to do it? I try to search the form but I can't get it.
Tiger
Re: mssql server 2012 express
Posted: Wed Sep 04, 2019 9:45 pm
by AUGE_OHR
hi,
Tiger wrote: ↑Wed Sep 04, 2019 3:50 am
And I just wonder how to export the query result to excel file. Can anyone guide me to do it? I
there is a Excel Demo in c:\hmg.3.4.4\SAMPLES\Controls\OLE\demo.prg
create a empty worksheet and pass hole Array like this
Code: Select all
PROCEDURE Excel(aData)
LOCAL oExcel, oHoja
oExcel := CreateObject( "Excel.Application" )
oExcel:WorkBooks:Add()
oHoja := oExcel:ActiveSheet()
// fill Sheet with Array
oHoja:value := aData
Re: mssql server 2012 express
Posted: Thu Sep 05, 2019 12:37 am
by Tiger
AUGE_OHR wrote: ↑Wed Sep 04, 2019 9:45 pm
hi,
Tiger wrote: ↑Wed Sep 04, 2019 3:50 am
And I just wonder how to export the query result to excel file. Can anyone guide me to do it? I
there is a Excel Demo in c:\hmg.3.4.4\SAMPLES\Controls\OLE\demo.prg
create a empty worksheet and pass hole Array like this
Code: Select all
PROCEDURE Excel(aData)
LOCAL oExcel, oHoja
oExcel := CreateObject( "Excel.Application" )
oExcel:WorkBooks:Add()
oHoja := oExcel:ActiveSheet()
// fill Sheet with Array
oHoja:value := aData
Thank for the hint, I will try this way.
Re: mssql server 2012 express
Posted: Tue Aug 02, 2022 3:25 pm
by mol
Hi!
I want to reftresh this topic.
I'm trying to rebuild my application, but, it doesn't want to connect to MSSQL server
My connection string:
cConStr := "Driver={SQL Server};"+;
"Server=" + cSQLSerwer + ";"+;
"Database="+ cSQLBaza + ";"+;
"Trusted_Connection=yes" + ";"+;
"Integrated Security=SSPI;" +;
"Uid=" + cSQLUser+ ";"+;
"Pwd="+ cSQLPassword +";"
lOK := hb_RDDINFO( RDDI_CONNECT, { "ODBC", cConStr })
lOK should be 0 if not connected and <> 0 if connected.
But, I'm getting an array as a result, containing exactly what I pass to RDDINFO - { "ODBC", cConStr }
Do you have any idea what can be wrong?
Any other ways to connect to mssql server?
Re: mssql server 2012 express
Posted: Tue Aug 02, 2022 4:13 pm
by jparada
Hi,
try ADO, small example:
Code: Select all
IF ( oConnection := win_OleCreateObject( "ADODB.Connection" ) ) == NIL
? "No es posible crear objeto conexión", win_OleErrorText()
RETURN NIL
ENDIF
BEGIN SEQUENCE WITH {|oError| BREAK( oError ) }
oConnection:Open("Provider=SQLNCLI11;Server=SERVERNAME\INSTANCENAME;Database=DBNAME;Uid=USER;Pwd=PASS;" )
RECOVER USING oError
? "Error al intentar conectar a la base de datos " + E"\n" + hb_Utf8ToStr(oError:Description)
RETURN NIL
END SEQUENCE
oRs := win_OleCreateObject( "ADODB.Recordset" )
cQry1 := "SELECT TOP 5 ccodigoagente AS Agente, cnombreagente AS Nombre FROM admAgentes"
BEGIN SEQUENCE WITH {|oError| BREAK( oError ) }
oRs:Open(cQry1, oConnection)
RECOVER USING oError
? "Error al realizar la consulta " + E"\n" + hb_Utf8ToStr(oError:Description)
END SEQUENCE
oRs:MoveFirst()
Do While !oRs:Eof()
AADD( aData , { oRs:Fields( "Nombre" ):Value, oRs:Fields( "Agente" ):Value } )
oRs:MoveNext()
ENDDO
oRs:Close()
oConnection:Close()
Regards,
Javier
Re: mssql server 2012 express
Posted: Tue Aug 02, 2022 6:15 pm
by mol
Thank you! I'll try this. How about speed?
Re: mssql server 2012 express
Posted: Wed Aug 03, 2022 1:54 pm
by jparada
Hi,
Compared against what?, anyway, I have no comparison parameter, since I personally have not used any other connection method, I only use ADO.
Regards,
Javier
Re: mssql server 2012 express
Posted: Thu Aug 04, 2022 12:28 pm
by mol
As I understand well, in ADO, when I get data from serwer, I must put it into table or .dbf file.
Using SQLMIX, I'm getting data into temporary table. There is a minimal change to old code to use this way of using sql server.
Am I wrong?