FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FWH and MS SQL
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
FWH and MS SQL
Posted: Fri May 18, 2012 01:32 AM

Hello Everyone,

We are looking to integrate MS SQL to our FWH ADS/DBF application. Does anyone have any examples on connecting/ending connection to MS SQL server and commands (SELECT, INSERT, UPDATE, DELETE)? It would be must appreciated.

Sincerely,

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: FWH and MS SQL
Posted: Fri May 18, 2012 04:50 AM
Connecting to MS SQL Database
Code (fw): Select all Collapse
// Connecting to MS SQL Database
cConnectSring:="Provider=SQLOLEDB;server=YourIP;database=YourDbName;uid=YourUserName;pwd=YourPassword"
TRY
  oConnection:=CreateObject("ADODB.Connection")
CATCH
  MsgInfo("It seems that your PC does not have MDAC installed OR MDAC is corrupted.")
  Return .F.
END
oConnection:ConnectionString:=cConnectSring

TRY 
  oConnection:Open()
CATCH oError
  MsgInfo("Failed to Connect to the Database")
  RETURN .F.
END


Disconnecting from the database
Code (fw): Select all Collapse
// Disconnecting 
if oConnection:State() = adStateOpen
  oConnection:Close()
Endif
oConnection:=NIL


For more eg on ADO and FWH visit the following article in FWH Wiki by Mr.Rick Lipkin
http://fivetechsoft.com/wiki/doku.php?id=ado-related_stuffs&rev=1216796127

Regards
Anser
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: FWH and MS SQL
Posted: Sat May 19, 2012 03:40 AM

Thank you for your assistance

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com

Continue the discussion