Hello,
I have installed the following application on a Windows 7 64 bit workstation. The object is created OK, but fails at oSql:Open( cSql, cConnectString ). However, I am able to ping IP address.
I have the following versions of SQL installed on the workstation. Am I missing something?
1. Microsoft SQL Server 2005 Compact Edition
2. Microsoft SQL Server 2008 Native Client
3. Microsoft SQL Server 2012 (64 Bit)
4. Microsoft SQL Server 2012 Native Client
5. Microsoft SQL Server Native Client
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
#include "FiveWin.ch"
//----------------------------------------------------------------//
function Main()
local cConnectString := "" , ;
cSql := "" , ;
oSql , ;
oDlg , ;
oLbx
// Connecting to MS SQL Database
cConnectString:="Provider=SQLOLEDB;server=64.78.59.231;database=globallogistics;uid=cdmwoodlands;pwd=Alexander1209"
// Connection Object ====> oSql:=CreateObject("ADODB.Connection")
TRY
oSql:=CreateObject("ADODB.Recordset")
CATCH
MsgInfo("It seems that your PC does not have MDAC installed OR MDAC is corrupted.")
RETURN (.F.)
END
MsgInfo( "Object Created!")
// Set SQL string...
cSql := "SELECT * FROM support"
TRY
oSql:Open( cSql, cConnectString )
CATCH oError
MsgInfo("Failed to Connect to the Database")
RETURN .F.
END
MsgInfo( "Connected to Database" )
// Check for EOF...
IF oSql:eof
MsgInfo( "No Data Found" )
oSql:Close()
oSql:=NIL
RETURN (.F.)
ENDIF
// Move to first...
oSql:MoveFirst()
// Dialog...
DEFINE DIALOG oDlg FROM 1,1 TO 35,104 TITLE "Support Ticket"
@00,00 LISTBOX oLbx FIELDS ;
oSql:Fields( "company_name" ):Value , ;
oSql:Fields( "contact_first" ):Value , ;
oSql:Fields( "contact_last" ):Value , ;
oSql:Fields( "contact_phone" ):Value , ;
oSql:Fields( "contact_email" ):Value , ;
oSql:Fields( "system" ):Value , ;
oSql:Fields( "module" ):Value , ;
oSql:Fields( "adddate" ):Value , ;
oSql:Fields( "addtime" ):Value , ;
oSql:Fields( "adduser" ):Value ;
SIZES 100 , 100 , 100 , 100 , 100 , 100 , 100 , 100 , 100 , 100 ;
HEADERS "Company", "First Name", "Last Name", "Telephone", "E-mail", "System", "Module", "Add Date", "Add Time", "Add User" ;
OF oDlg
oLbx:bLogicLen = { || oSql:RecordCount }
oLbx:bGoTop = { || oSql:MoveFirst() }
oLbx:bGoBottom = { || oSql:MoveLast() }
oLbx:bSkip = { | nSkip | Skipper( oSql, nSkip ) }
oLbx:cAlias = "ARRAY1"
ACTIVATE DIALOG oDlg ON INIT ( oDlg:SetControl( oLbx ), Sysrefresh() )
// Disconnecting
oSql:Close()
oSql:=NIL
RETURN (.T.)
//-------------------------------
STATIC FUNCTION SKIPPER( oRsx, nSkip )
LOCAL nRec := oRsx:AbsolutePosition
oRsx:Move( nSkip )
IF oRsx:EOF; oRsx:MoveLast(); ENDIF
IF oRsx:BOF; oRsx:MoveFirst(); ENDIF
RETURN( oRsx:AbsolutePosition - nRec )