SQL Server

Topics: Developer Forum
Feb 1, 2012 at 12:20 PM

I have a SQL Server hosted at discountasp.net and just cannot figure out how to connect to this server. Also, I have stored procedures on the server that I normally use to query and write data. How is this accomplished in activeVFP? Thanks in advance.

Coordinator
Feb 1, 2012 at 3:23 PM

Did you check the example in the demo??   http://thetechconsult.com/demo/default.aspx?action=sqllist

*sql
   

 oSQL = CREATEOBJECT("AVFPsql")
    lcLast=NVL(oRequest.Form("lastname"),"")
    oSQL.LogIn(['Driver={SQL Server}; Server=avfpdemo.db.6054633.hostedresource.com; Database=avfpdemo; Uid=yourUID; Pwd=yourPwd;'])
    oSQL.cSQLCursor = "tCursor"
    oSQL.Execute([SELECT  Au_fname as First,Au_lname as Last,City,Contract  ]+;
              [ FROM Authors ]+;
              [ WHERE au_lname like '] +lcLast +[%' order by au_lname] )

Feb 3, 2012 at 12:52 PM

I have followed the example in the demo. I've been using the same connection string in my vfp apps to connect to the remote SQL database. The error I get is

Caught .NET exception, source: SQLLIST.AVFP 0000e2i1002o err#= 11 line= 104 Function argument value, type, or count is invalid.11 Function argument value, type, or count is invalid. .NULL. .NULL. .NULL. .NULL. .NULL. c:\avfp5.61demo\activevfp.dll message: c:\avfp5.61demo\activevfp.dll

 

Just can't thank enough to you and others in the VFP community.

Coordinator
Feb 3, 2012 at 9:33 PM

Yeah, you'll need to work thru the errors, dude.  That's an error in your foxpro code, not the SQL connection