Conexión con MSSQL

Conexión con MSSQL

Postby leandro » Mon Feb 22, 2016 6: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

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Conexión con MSSQL

Postby Baxajaun » Tue Feb 23, 2016 11:41 am

Buenos días Leandro,

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

Saludos
User avatar
Baxajaun
 
Posts: 968
Joined: Wed Oct 19, 2005 2:17 pm
Location: Gatika. Bizkaia

Re: Conexión con MSSQL

Postby Rick Lipkin » Tue Feb 23, 2016 1: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: Select all  Expand view

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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Conexión con MSSQL

Postby leandro » Tue Feb 23, 2016 3: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

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Horizon and 97 guests