Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Connection Problem
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01054056
Message ID:
01054072
Views:
25
There is no password on the database. Here's the error I'm getting now:

The error:
"Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'sa'.

My conn string:
DRIVER=SQL Server;SERVER=DSERVER3;database=Euro_Mig_subset;uid=sa;pwd='sa'


Here's my updated code:
HIDDEN PROCEDURE _SQLConnect
	
LOCAL bRetVal, iErrNo, sErrMsg, aErrInfo[1]
bRetVal = TRUE
	
WITH This
	
  ** Suppress ODBC error dialog
  SQLSETPROP(0, "DispWarnings", .F.)

  ** Suppres login dialog 
  SQLSETPROP(0, "DispLogin", 3)

  ** Attempt to connect to the database
  ._iConnHandle = SQLSTRINGCONNECT(._sSqlConnStr)

  ** If not connected...
  IF ._iConnHandle < 0
	
    ** Get the error information
    AERROR(aErrInfo)
    iErrNo	= aErrInfo[1]
    sErrMsg	= aErrInfo[2]
			
    ** Format the error message
    .sMessage = "Unable to connect to SQL database" + CHR(13)+;
                "Error " + TRANSFORM(iErrNo) + CHR(13)+;
                sErrMsg

    ** Turn on the class's error flag
    .bErrorOccured = TRUE
		
    ** Set the function return value to false
    bRetVal = FALSE
		
  ENDIF

ENDWITH	
	
RETURN bRetVal

ENDPROC
>What's your question?
>
>>I'm now getting prompted for a password.
>>
>>
>>>Try
>>>._sSqlConnStr = "DRIVER=SQL Server;SERVER=DSERVER3;database=Euro_Mig_subset;uid=sa;password=''"
>>>._iConnHandle = SQLSTRINGCONNECT(._sSqlConnStr)
>>>
>>>
See also Re: SQL Connection Error Message #835711
>>>
>>>
>>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform