You probably need VFP 6 to do this.
>Hi John! I know you've been playing with ADO so I thought I'd address this to you.
>
>I just got back from a NT Developer's Conference in Atlanta and have been playing with DCOM under MTS. I have a simple component written in VB that uses ADO to query a SQL Server back end. From the VFP command line I can create the object and execute the method no problem, except that the data doesn't get returned. Here's the GetData method from the component:
>
>
>****************************
>Function GetData(strYear As String) As String
> On Error GoTo DataError
>
> Dim myConn As ADODB.Connection
> Dim myCmd As ADODB.Command
> Dim myRS As ADODB.Recordset
>
> Set myConn = New ADODB.Connection
> Set myCmd = New ADODB.Command
> Set myRS = New ADODB.Recordset
>
> myConn.Open "DSN=Almis01;UID=sa;PWD=hahaha;DATABASE=Almis01"
> myCmd.ActiveConnection = myConn
> myCmd.CommandText = "Select * " _
> & "From Labforce " _
> & "Where Stfips = '01' " _
> & "And Areatype = '01' " _
> & "And Area = '000000' " _
> & "And Periodyear = '" _
> & Trim(strYear) & "' " _
> & "And Periodtype = '1' " _
> & "And Period = '00' " _
> & "And Adjusted = 'N' "
>
> myRS.CursorType = adOpenStatic
>
> myRS.Open myCmd
>
> myRS.MoveFirst
>
> GetData = CStr(myRS("Unemp"))
>
>DataError:
> strErrorMsg = Err.Description
> GetData = strErrorMsg
>
>End Function
>****************************
>
>
>In the VFP command window I do the following:
>
>myobj = CREATEOBJECT("ADOTest.GetLAUS")
>result = myobj.GetData("1994")
>? result
>
>When I do this, I get an empty string back instead of the field contents. When I send in an empty string as a parameter for GetData, I get the error message returned as expected. The query used works in ISQL and returns one record. I even tested the code in an ASP and that worked fine.
>
>So, is there something I'm missing?
>
>TIA