Hi Bob:
I'm just beginning work with ADO and saw your code. Have a question. Why did you use "This." for the recordset "oRSList" - you did not use "This." for "oConn" nor "oCommand"?
Thanks,
Mal
>Hi Pete,
>I don't know if this will help but here's one I use for something similar:
>
>* datacontrol.GetECOsForPart
>LPARAMETERS tcPart,tcDate
>LOCAL lcSQL
>oConn = CREATE('ADODB.Connection')
>WITH oConn
> .ConnectionString = 'File Name=ECC.UDL'
> .Open
>ENDWITH
>THIS.oRSList = CREATE('ADODB.RecordSet')
>WITH THIS.oRSList
> .CursorLocation = adUseClient
> .CursorType = adOpenStatic
> .LockType = adLockReadOnly
>ENDWITH
>oCommand = CREATE('ADODB.Command')
>WITH oCommand
> .CommandText = 'sp_getecosforpart_date'
> .CommandType = adCmdStoredProc
> .Parameters.Append(oCommand.CreateParameter("@part",adChar,,16,tcPart))
> .Parameters.Append(oCommand.CreateParameter("@date",adChar,,10,tcDate))
> .ActiveConnection = oConn
>ENDWITH
>THIS.oRSList.Open(oCommand)
>
>HTH
>>Hello Gang,
>>does anyone know a way to create a Client Side ADO recordset from a ADO Command object containing one or more Parameter objects, I can do it by creating the empty RecordSet object and setting the properties before the Open method is called, but I need to create a RecordSet with the Command object, here is what I've done so far
>>
>>Form method: SetupConnection
>>
>>with this
>> if .ConnectionEstablished
>> return .t.
>> endif
>> .oConnection = create('ADODB.Connection')
>> .oConnection.Open(.ConnectionString) && Set in the Init
>> .oCommand = create('adodb.Command')
>> .oCommand.ActiveConnection = .oConnection
>> .oCommand.CommandText = .cSQLString && Set in the Init
>> .oParameter_Batch_No = .oCommand.CreateParameter('batch_no',ADINTEGER,ADPARAMINPUT,2,.batch_no)
>> .oCommand.Parameters.Append(.oParameter_Batch_No)
>> .ConnectionEstablished = .t.
>>endwith
>>
>>I then issue: .oRecordset = .oCommand.Execute(), which creates the RecordSet ok but it's server side. Apart from closing and reopening the RecordSet, I can't think of another way to set the location, any ideas gratefuly received
>>
>>Regards
>>
>>
>>Pete Kane
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only