Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
| Search | Today's Posts | Mark Forums Read
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 9th, 2005, 11:31 PM
Registered User
 
Join Date: Jul 2003
Location: , , Bangladesh.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Oracle global temporary table and VB

I have create a global temporary table in oracle database as follows

Create global temporary table tmpDataGroup
(
DATAGROUPID number(15),
DESCRIPTION VARCHAR2(50)
) ON COMMIT Delete ROWS ;

Then I create following package and stored procedure.

CREATE OR REPLACE PACKAGE sp_getData AS
    TYPE cursor_Data IS REF CURSOR;
END sp_getData;


CREATE OR REPLACE PROCEDURE sp_GetTestData1(
    io_cursor IN OUT sp_getData.cursor_Data
)
AS
BEGIN
    INSERT INTO tmpDataGroup SELECT * FROM DATAGROUP;
              OPEN io_cursor FOR
    SELECT * FROM tmpDataGroup;
END sp_GetTestData1;

When I call sp_GetTestData1 from following strored procedure, it works fine. Records returns ( DataGroup table contains 12 rercords).

But when I call sp_GetTestData1 from visual basic 6, no records returns. I use follow Vb code.

Dim cmd As ADODB.Command
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim SpName As String, CONNECTION_STRING As String
    Set cmd = New ADODB.Command
    SpName = "sp_getTestData1"
    CONNECTION_STRING = "File Name=" & App.Path & "\MyDataLink.UDL"
    Set rst = New ADODB.Recordset
    With cmd
        Set rst = New ADODB.Recordset
        .ActiveConnection = CONNECTION_STRING
        .CommandType = adCmdStoredProc
        .CommandText = SpName
        .Properties("PLSQLRSet") = True
       'rst.Open cmd, , adOpenForwardOnly, adLockReadOnly
       Set rst = .Execute()
    End With
    If Not rst.EOF Then
        recArray = rst.GetRows()
        reccount = UBound(recArray, 2) - LBound(recArray, 2) + 1
    End If
    MsgBox (reccount)
    Set rst = Nothing
    Set cmd = Nothing

I will be very pleased if any one can tell me what is the problem.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Temporary table in a shopping cart project ann03 ASP.NET 2.0 Professional 1 October 5th, 2007 07:50 PM
Return TYPE TABLE to VB from Oracle muttleychess Pro VB Databases 3 August 2nd, 2006 03:28 PM
How to create a Temporary Table fdtoo SQL Server 2000 0 April 11th, 2006 08:38 PM
Create Temporary Table jmss66 Classic ASP Databases 5 March 11th, 2004 01:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.