Page 1 of 1

set query properties?

Posted: Tue 17 Apr 2007 09:52
by Ludek
I can make following using visual basic

Code: Select all

   Dim cn As ADODB.Connection, rs As ADODB.Recordset, SQL As String
        
        Set cn = New ADODB.Connection
        Set rs = New ADODB.Recordset
        cn.CursorLocation = adUseServer
        
        'cn.Open "Provider=SQLOLEDB.1;Integrated security=SSPI;Data Source=...;Initial Catalog=..."
        cn.Open "Provider=SQLNCLI;Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=...;Data Source=..."
        SQL = "select my_id,txt from dbo.texttest"
       
        rs.Open SQL, cn, adOpenKeyset, adLockOptimistic
how can I set things like "adLockOptimistic", "adUseServer", "adUseClient" using SDAC? I hope, setting your property CursorType to "ctKeyset" is identical to "adOpenKeyset" in visual basic.

Posted: Tue 17 Apr 2007 13:49
by Jackson
Yes, you should use the TCustomMSDataSet.CursorType property to set a cursor type.
Please refer to TCustomMSDataSet.CursorType property description is SDAC help for more information.

Posted: Thu 19 Apr 2007 06:44
by LudekS
I'm sorry, I can't see anything in the help about optimistic locking... only the cursor types Keyset, etc... do i understand it correct: the ctDefaultResultSet equivalent to use of adUseClient in VB?

Posted: Thu 19 Apr 2007 09:34
by Jackson
Yes, using the adUseClient value for the connection.CursorLocation property in ADO is equivalent to using the ctDefaultResultSet value for the TMSQuery.CursorType property in SDAC.