Re: VB6 Err 3251
- From: "Ralph" <nt_consulting64@xxxxxxxxx>
- Date: Thu, 9 Jul 2009 09:54:53 -0500
"Kicks123" <Kicks123@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D867293C-83B6-41E5-BEDE-67BDA02037AC@xxxxxxxxxxxxxxxx
Hibelow
I am having a problem using ADO 2.8 and SQL Server 2000.Im using the
SQLOLEDB Provider and when Im trying to set the Index by using the code
i receive the ffg error...Error 3251 : Current Provider does not supportthe
necessary interface for Index functionality...Please advise if what imdoing
is correct or do I need to use another provider? I have to use SQL Serveras
our Access databases are quite large...Does the index and seek functioneven
work with ADO and SQL Server 2000?...I am migrating from DAO to ADO to usethe
SQL Server and Im trying not to change the existing code so I need to use
Index and Seek functionality as it has been used everywhere...There are nowould
links between any tables so I am accessing the table directly.Any help
be appreciated !!!Security=SSPI;Persist
Dim Db as new ADODB.Connection
Dim rs as new ADODB.Recordset
Db.Provider = "SQLOLEDB.1"
Db.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security Info=False;Initialwhen
Catalog=FaskStock;Data Source=myDSN"
Db.Open
With rs
.ActiveConnection = Db
.Source = "Areas"
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.Open Options:=adCmdTableDirect
.Index = "AreaCode" 'the error i receive is on this line
setting the index
.Seek "03"
If (Not .EOF And Not .BOF) Then
MsgBox rs.Fields("AreaName").Value
Else
MsgBox "Record not found"
End If
.Close
End With
Set rs = Nothing
Set Db = Nothing
End Sub
--
Thanks
Kicks123
Simply put, very few providers support the Index & Seek methods, and as you
discovered, this can be problematic when converting from one
database/provider solution to another. You may find another provider that
will work.
[Note: Use the .Supports method to test various combinations:
http://www.w3schools.com/ado/met_rs_supports.asp
]
Another problem with using .Index, .Seek, and let's add .Find to the list,
is that they are heavily dependent on specific cursors. For example, your
code only works if using a server-side cursor and a table direct command.
Frankly you are better off biting the bullet and converting your code to
queries with criteria, and later, even better, rolling them into Stored
Procedures. This will give you the best performance when using SQL Server.
-ralph
.
- References:
- VB6 Err 3251
- From: Kicks123
- VB6 Err 3251
- Prev by Date: VB6 Err 3251
- Previous by thread: VB6 Err 3251
- Index(es):
Relevant Pages
|