>CLEAR >CLOSE DATABASES ALL > >LOCAL nHandle, cString, nResult, aErrors[1], lError > >** Connect to the Pubs DB >ON ERROR lError = .T. > >cString = "DSN=northwind;uid=username;pwd=password;database=pubs" >nHandle = SQLSTRINGCONNECT(cString) > >ON ERROR > >IF nHandle > 0 > > ** Get all author records from california > nResult = SQLEXEC(nHandle, "select * from authors where state = 'CA'", "authors") > > ** Disconnect > =SQLDISCONNECT(nHandle) > >ELSE > > ? "Failed to connect" > > =AERROR(aErrors) > MESSAGEBOX(aErrors[2],16, "Connection Error") > >ENDIF >