set query properties?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Ludek
Posts: 301
Joined: Thu 12 Oct 2006 09:34

set query properties?

Post by Ludek » Tue 17 Apr 2007 09:52

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.

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Tue 17 Apr 2007 13:49

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.

LudekS
Posts: 3
Joined: Thu 12 Oct 2006 09:46

Post by LudekS » Thu 19 Apr 2007 06:44

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?

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Thu 19 Apr 2007 09:34

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.

Post Reply