Re: VB6 Err 3251

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance





"Kicks123" <Kicks123@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D867293C-83B6-41E5-BEDE-67BDA02037AC@xxxxxxxxxxxxxxxx
Hi

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
below
i receive the ffg error...Error 3251 : Current Provider does not support
the
necessary interface for Index functionality...Please advise if what im
doing
is correct or do I need to use another provider? I have to use SQL Server
as
our Access databases are quite large...Does the index and seek function
even
work with ADO and SQL Server 2000?...I am migrating from DAO to ADO to use
SQL Server and Im trying not to change the existing code so I need to use
the
Index and Seek functionality as it has been used everywhere...There are no
links between any tables so I am accessing the table directly.Any help
would
be appreciated !!!

Dim Db as new ADODB.Connection
Dim rs as new ADODB.Recordset

Db.Provider = "SQLOLEDB.1"
Db.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist
Security Info=False;Initial
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
when
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


.



Relevant Pages

  • Re: Disabling ASP.net 2.0 Membership
    ... I checked out the article you referenced and implemented my own provider. ... as a FoxPro database, an Oracle database, or other data sources. ... custom connection string so that I can use the Commerce Server SQL Server ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: ERROR: Provider Management - Could not establish a connection to t
    ... If you have not yet created the SQL Server database, ... Can any data provider be used to ... Exception Details: System.Data.SqlClient.SqlException: A connection ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: .NET data provider or OLEDB provider?
    ... >I don't see where you see a built-in query engine. ... >service provider, ... >OLE DB providers don't have to support SQL however, ... > SQL Server linked server, SQL Server can handle the queries. ...
    (microsoft.public.data.oledb)
  • Re: Need Help: Operating system error 3706
    ... Installing an additional component resolved the problem and the software is now able to connect to the database ... The developer is currently doing a complete rewrite/update of the program, including database functions. ... While this would require a modest re-write, it's not that tough to convert to a managed-code provider instead of the COM-based OLE DB provider. ... If the application is not based on .NET, then make sure the application is upgraded to use the SNAC (SQL Server Native Client) provider which is less trouble-prone than the older MDAC-based providers. ...
    (microsoft.public.sqlserver.connect)
  • Re: ERROR: Provider Management - Could not establish a connection to t
    ... If you have not yet created the SQL Server database, ... Can any data provider be used to ... pipes and I have the server configured to connect using TCP/IP. ...
    (microsoft.public.dotnet.framework.aspnet)