Database use cursor (Cursor) Problem __ Database

Source: Internet
Author: User

Here to say is not the definition of specific cursors and the use of methods, but the database stored procedure return type is a cursor, VC use ADO technology how to obtain data in the cursor problem.        What is the difference between Postgre and SQL Server. Beginning to think that using a Recordset object to open a recordset as a cursor, you can get the data in the recordset in the normal way.          However, no success under Postgre, GetRecordCount get the correct number of records, getadoeof is not true, but getcollect or GetItem when the exception. Later installed SQL Server 2000 try to create a userinfo table and write a simple stored procedure. Stored procedures are as follows: CREATE PROCEDURE [GetUserInfo] as DECLARE record_cur CURSOR for SELECT ID, username from userinfo OPEN reco   Rd_cur fetch NEXT from the record_cur deallocate record_cur go this call to the stored procedure to retrieve the correct value. In comparison, the method of using ADO technology is the same, but SQL Server 2000 can get the cursor in the stored procedure and read the data inside (key two statements below) Fetch NEXT from Record_cur deallocate record_cur The recordset has the correct fields and values in the recordset after executing the SQL statement.   This does not appear to be an exception.   The stored procedure for the Postgregre database must have a return value, so refcursor as a return cannot add the FETCH NEXT from Record_cur deallocate in the stored procedure Record_cur In this way, although the execution of Precordset->open (...) There is no error, but the data in the cursor is not actually read.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.