FW MS-SQL Server

FW MS-SQL Server

Postby ip_ram » Thu Sep 17, 2020 1:35 pm

Hello!

Does FW access MS-SQl Server as well as access MySQL?

Tks

Rodrigo Melo
Brazil
User avatar
ip_ram
 
Posts: 43
Joined: Tue Nov 21, 2006 4:07 pm
Location: Brazil / MG / Belo Horizonte

Re: FW MS-SQL Server

Postby nageswaragunupudi » Thu Sep 17, 2020 7:49 pm

YES
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FW MS-SQL Server

Postby ip_ram » Thu Sep 17, 2020 11:54 pm

Tks
User avatar
ip_ram
 
Posts: 43
Joined: Tue Nov 21, 2006 4:07 pm
Location: Brazil / MG / Belo Horizonte

Re: FW MS-SQL Server

Postby Rick Lipkin » Fri Sep 18, 2020 1:53 pm

Ado connects to most Sql Databases ... go to the website Connectionstrings.com

https://www.connectionstrings.com/ole-d ... ql-server/

Code: Select all  Expand view


xPROVIDER    := "SQLOLEDB"
xSOURCE      := "MYCOMUTER-PC\SQLEXPRESS"
xCatalog       := "MyDatabaseName"
xUserId         := "sqluserID"
xPASSWORD := "mypassword"


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


// global connection string
xConnect := CREATEOBJECT( "ADODB.Connection" )

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

 


Or have a look at
\source\function\adofuncs.prg ... simplified ado wrappers

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2663
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: FW MS-SQL Server

Postby ip_ram » Sat Sep 19, 2020 10:41 pm

Rick,

Tks
User avatar
ip_ram
 
Posts: 43
Joined: Tue Nov 21, 2006 4:07 pm
Location: Brazil / MG / Belo Horizonte

Re: FW MS-SQL Server

Postby nageswaragunupudi » Mon Sep 21, 2020 4:07 pm

FWH recommends:
Code: Select all  Expand view

oCn := FW_OpenAdoConnection( { "MSSQL", cServer, cCatalog, cUser, cPassword }, .t. )
if oCn == nil
   ? "not connected"
return nil
// do your work
oCn:Close()
 


You need not bother about connection strings. FWH does all that work for you.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 16 guests