FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Conexi贸n con MSSQL
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Conexi贸n con MSSQL
Posted: Mon Feb 22, 2016 06:56 PM

Buenas tardes para todos

Como dice el encabezado, necesito realizar una conexi贸n con MSSQL. Alguien ha tenido experiencia con esto? Alguna cadena de conexi贸n?

Saludos

Saludos
LEANDRO AREVALO
Bogot谩 (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 990
Joined: Wed Oct 19, 2005 02:17 PM
Re: Conexi贸n con MSSQL
Posted: Tue Feb 23, 2016 11:41 AM
Buenos d铆as Leandro,

aqu铆 las tienes https://www.connectionstrings.com/sql-server/

Saludos
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Conexi贸n con MSSQL
Posted: Tue Feb 23, 2016 01:05 PM
LEANDRO

If you want to use the native OleDB 32 bit provider ( included in all versions of windows 32 bit ) .. here is an example of how to create your global connection
Code (fw): Select all Collapse
Local xProvider,xSource,xCatalog,xUseris,xPassword,xString
Public oConnect

xSource 聽 := "<your server name"
xPROVIDER := "SQLOLEDB"
xCATALOG 聽:= "<your database>"
xUSERID 聽 := "<your userid that has rights to your database>"
xPASSWORD := <your password to the above userid >

xString := 'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Initial Catalog='+xCATALOG+';User Id='+xUSERID+';Password='+xPASSWORD

oConnect := CREATEOBJECT( "ADODB.Connection" ) 聽 聽// oConnect is public connection object

TRY
聽 聽oConnect:Open( xString )
CATCH oErr
聽 聽Saying := "Could not open a Global Connection to Database "+xSource
聽 聽MsgInfo( Saying )
聽 聽 聽RETURN(.F.)
END TRY


Once you create your global connection string you can pass oConnect to open any recordset.

Rick Lipkin
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: Conexi贸n con MSSQL
Posted: Tue Feb 23, 2016 03:39 PM

Muchas gracias por responder:

Voy a hacer unas pruebas y comento. :D

Saludos
LEANDRO AREVALO
Bogot谩 (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]

Continue the discussion