Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO Recordsets and CursorLocation Property
Message
De
14/09/1999 07:19:49
Bob Tracy
Independent Consultant
Driftwood, Texas, États-Unis
 
 
À
13/09/1999 22:53:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00263979
Message ID:
00264364
Vues:
24
Hello Malcolm,
The particular method I posted passes the resultant recordset back to a middle tier business object and since there is more happening than is shown in the code example, I made it a property of the class "DataControl" so it doesn't go out of scope when the method closes. References oConn and oCommand are local to the method and I don't need them beyond the life of the method. It's not really necessary to do it this way if you're using the object reference only during the scope of the method.

An even better way, and one I'm currently beginning to use, is to use the Stored Property Manager in MTS to manange properties that passed between objects within the current object context.

This stuff can really make your head hurt! HTH.


>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
Bob Tracy

Never engage in a battle of wits if you're only half armed.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform