Solved

AS400 and ADO. Recordset not bookmarkable?

Posted on 2000-05-17
8
472 Views
Last Modified: 2013-12-25
I am trying to create an ADO Recordset from an AS400 Table and display the recordset in a DataGrid. My problem is that I get an error message stating that my recordset is not bookmarkable. Is there a way to control this under ADO? If I set up a DataEnvironment with a connection and row-returning command, then the resulting recordset is bookmarkable, and works fine with the DataGrid. If I try to do it myself with code (ADODB.Connection, ADODB.Command and ADODB.Recordset) then I get the bookmarkable problem. Any hints/tips/solutions?
0
Comment
Question by:bhlang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 31 total points
ID: 2818162
Not all provider are bookmarkable!

Try to set your CursorLocation to adUseClient.
0
 

Author Comment

by:bhlang
ID: 2818234
The problem is this:
If I use the DataEnvironment, the Recordset is bookmarkable, and works fine with the DataGrid. If I do it with an ADODB.Recordset, it is not bookmarkable.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2818291
Have you tried changing the CursorLocation?

You can also look at your Connection object (from the DataEnvironment) click on the ALL tab and look the properties.

Try these settings.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 18

Expert Comment

by:mdougan
ID: 2818844
Show us the code for what you've tried using the ADODB.Recordset
0
 

Author Comment

by:bhlang
ID: 2819229
I'll get back to you sometime tomorrow with updates on my code and my Connection settings. I've left work for the day and will be back in the office tomorrow.
0
 

Author Comment

by:bhlang
ID: 2838811
Here's the code I'm using:

Public cnnAS400         As ADODB.Connection
Public rsDTNAME         As ADODB.Recordset
Public Const sysName = "AS400NAME"
Public Const coLib = "COMP02"


Public Sub createAS400Link()
    Dim strQuery        As String
    'Create & Open Connection to Database
    Set cnnAS400 = New ADODB.Connection
    cnnAS400.ConnectionString = "DRIVER={Client Access ODBC Driver (32-bit)};" & _
        "SYSTEM=" & sysName & ";CMT=0;DBQ=" & coLib & "DT;NAM=0;DFT=0;DSP=0;TFT=0;" & _
        "TSP=0;DEC=0;XDYNAMIC=0;RECBLOCK=0;BLOCKSIZE=512;SCROLLABLE=0;TRANSLATE=0;" & _
        "LAZYCLOSE=0;LIBVIEW=0;REMARKS=0;CONNTYPE=0;SORTTYPE=0;LANGUAGEID=ENU;" & _
        "SORTWEIGHT=0;PREFETCH=0;MGDSN=0;"
    cnnAS400.Open
    'Create Recordset
    Set rsDTNAME = New ADODB.Recordset
    strQuery = "SELECT MNAME, MCO, MADDR, MSTRT, MCITY, MPROV, MCNTRY, MPO1, MPO2, " & _
        "MGROUP, MID FROM " & coLib & "DT.DTNAME Order By MNAME"
    rsAS400.Open strQuery, cnnAS400, adOpenDynamic, adLockOptimistic, adCmdText
End Sub
0
 

Author Comment

by:bhlang
ID: 2838820
I used the DataEnvironment to get the connection string. This connection string works. The resulting recordset (rsDTNAME, not rsAS400 as is listed in the OPEN command) is NOT bookmarkable, and I need it to be in order to use the DataGrid effectively.
0
 

Author Comment

by:bhlang
ID: 2839108
Well, today it's working for some reason. I did the following:
1. Made sure I set the CursorLocation to adUseClient
2. Changed the Reference from Microsoft ActiveX Data Objects 2.0 Library to Microsoft ActiveX Data Objects 2.1

Not sure which of these changes did the trick, but as I received the advice on the first, and that may have been the problem, I'll give the points to emoreau.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question