Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLEDB --- Index Property

Status
Not open for further replies.

Yura

Programmer
Jun 27, 2000
6
BY
May be anybody known -- How to use index property of recordset with SQLOLEDB provider?<br><br>Dim cnnSQL As ADODB.Connection<br>Set cnnSQL = New ADODB.Connection<br>cnnSQL.Provider = &quot;SQLOLEDB&quot;<br>cnnSQL.ConnectionString = &quot;Persist Security Info=False;User ID=sa;Initial Catalog=DogovorSQL;Data Source=Tanya&quot;<br>cnnSQL.Open<br><br>Dim rst As ADODB.Recordset<br>Set rst = New ADODB.Recordset<br>With rst<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.CursorLocation = adUseServer<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.CursorType = adOpenKeyset<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.LockType = adLockOptimistic<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Open &quot;Owners&quot;, ActiveConnection:=cnnSQL, Options:=adCmdTableDirect<br>End With<br><br><br>After that we looking the support of index property. rst.Supports (adIndex) = FALSE !!!&nbsp;&nbsp;<br>Why?<br>How I can open recordset object with rst (adIndex) = True?<br>Does Seek method support SQLOLEDB provider?<br><br>Sorry for language.<br>
 
using ado with odbc, anyway, the statement would be:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;rst.index=(&quot;field1&quot;)&nbsp;&nbsp;&nbsp;&nbsp;for example, where field1 is the literal name<br>of the column.&nbsp;&nbsp;You can also use the 'number' (in the recordset)<br>of the field, i.e., rst.index = 3.&nbsp;&nbsp;And you can specify more than one<br>field, with &quot;asc&quot; (the default) or &quot;desc&quot; for each.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top