Page 1 of 1

FW MS-SQL Server

Posted: Thu Sep 17, 2020 1:35 pm
by ip_ram
Hello!

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

Tks

Rodrigo Melo
Brazil

Re: FW MS-SQL Server

Posted: Thu Sep 17, 2020 7:49 pm
by nageswaragunupudi
YES

Re: FW MS-SQL Server

Posted: Thu Sep 17, 2020 11:54 pm
by ip_ram
Tks

Re: FW MS-SQL Server

Posted: Fri Sep 18, 2020 1:53 pm
by Rick Lipkin
Ado connects to most Sql Databases ... go to the website Connectionstrings.com

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

Code: Select all


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

Re: FW MS-SQL Server

Posted: Sat Sep 19, 2020 10:41 pm
by ip_ram
Rick,

Tks

Re: FW MS-SQL Server

Posted: Mon Sep 21, 2020 4:07 pm
by nageswaragunupudi
FWH recommends:

Code: Select all

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.