|
To me it looks like the the cursortype is incorrect. By default the cursortype of a recordset defaults to adForwardOnly. That cursortype doesn't support movelast. At least that is what I encountered. The example below worked for me. I'm not exactly sure how to change the recordset cursortype when creating a recordset from a command. Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim strSQL As String With cn .ConnectionTimeout = 5 .Provider = "IBMDA400" .Properties("Data Source") = "XXXXXXXX" CursorLocation = adUseServer .Open End With strSQL = "SELECT * FROM GRIZLIB.GRIZFILE ORDER BY JBNUM DESC" rs.Open (strSQL), cn, adOpenDynamic, adLockOptimistic rs.MoveLast -----Original Message----- From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Trow, Jim Sent: Sunday, September 26, 2004 12:13 PM To: midrange-l@xxxxxxxxxxxx Subject: IBMDA400 Good afternoon, Before I begin, I'd like to extend a personal thanks to Mr. Donald Fisher and Mr. Paul Tydoki for their assistance with our "One DDS, Two Different Printers" issue from last week. Their input provided us with enough direction that we were able to resolve it - thank you! Now for the current issue... We're developing a Visual Basic application which includes a connection to one of our AS/400's via the IBMDA400 provider for data retrieval purposes. To clarify, I should say that we're attempting to develop as we've not been able to successfully retrieve any data to date. Our connection is valid and the tables are accurately defined, however a simple record count shows a result set of -1 on a table that we know contains several hundred records. I've read well over a thousand pages of documentation on DB2, IBMDA400, and the like and am still unable to resolve this issue. Listed below is the section of VB code as well as the errors we see after enabling trace, any feedback would be greatly appreciated: Sub as400_connect2() On Error GoTo close_connect Dim cn400 As New ADODB.Connection Dim cmd400 As New ADODB.Command Dim rst400 As ADODB.Recordset cn400.Open "Provider=IBMDA400;Data Source=AS400;", "", "" Set cmd400.ActiveConnection = cn400 cmd400.CommandText = "SELECT * FROM TONY.JLFLASH ORDER BY LPCOMP" cmd400.CommandType = adCmdText Set rst400 = cmd400.Execute rst400.MoveLast .MoveLast returns error of "-2147217896 Rowset position cannot be restarted." even though it is listed as a supported method of the Recordset Object. We're getting these errors in the trace log: 0x0000079C 0x000002B8 09/24/04 16:57:52 : CSQLRowset::RestartPosition 0x0000079C 0x000002B8 09/24/04 16:57:52 : CSQLRowset::RestartPosition returning CANNOTRESTART on forward-only cursor Best regards, Jim James D. Trow Information Systems Supervisor Dick Blick Holdings, Inc. Ph: (847) 681-6820 Cell: (847) 309-4760 Email: <mailto:tj.trowj@xxxxxxxxxxxxx> J.Trow@xxxxxxxxxxxxx
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.