Solved

Row-00001 Cannot allocate memory

Posted on 2003-12-04
6
3,033 Views
Last Modified: 2007-12-19
Dear all,

I have a question in database programming with VB and Oracle 8i.

During I use VB to retrieve a large field record (the field size about 5000 varchar2). The program will be occurred error "ROW-00001 Cannot allocate memory".

But there are no error during retrieving little size field record.

I am using:
-- VB6
-- Oracle 8i OLDDB Provider

Thanks,
Daniel
0
Comment
Question by:wongchun
  • 3
  • 3
6 Comments
 
LVL 29

Expert Comment

by:leonstryker
ID: 9904350
Can I see your connection and recordset code please.

Leon
0
 
LVL 1

Author Comment

by:wongchun
ID: 9910193
'=============================================
' Function for get connection
'=============================================
Public Function open_dbconnect() As Connection

On Error GoTo errorhandler

Dim na_conn As ADODB.Connection
Set na_conn = CreateObject("ADODB.Connection")

na_conn.ConnectionString = "Provider=OraOLEDB.Oracle;" & _
                          "Data Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = " & v_host & ")(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = " & v_dbname & ") ) );" & _
                          "User ID=" & v_dbuser & ";" & _
                          "Password=" & v_dbpassword & ";" & _
                          "PLSQLRSet=1;"


na_conn.Open
Set open_dbconnect = na_conn

Exit Function

errorhandler:

    MsgBox "Fail to connect to database"

End Function

'=============================================
' Program
'=============================================
Set na_conn = open_dbconnect
   
        Dim param_return_status As ADODB.Parameter
        Dim param_bank_code As ADODB.Parameter
        Dim param_corp_id As ADODB.Parameter
        Dim param_lang As ADODB.Parameter
        Dim na_cmd As ADODB.Command
           
        Set na_cmd = New ADODB.Command
        Set recset = New ADODB.Recordset
       
        If recset.State <> 0 Then
            recset.Close
        End If

        Set param_bank_code = na_cmd.CreateParameter("param_bank_code", adVariant, adParamInput, 4, Bankcode)
        Set param_corp_id = na_cmd.CreateParameter("param_corp_id", adVariant, adParamInput, 10, Trim(rtfCorpIdSearch.Text))
        Set param_return_status = na_cmd.CreateParameter("param_return_status", adSmallInt, adParamOutput)
       
        ' Get the Corporate Name
        na_cmd.CommandText = "{CALL pkg_admin.sp_get_corp_details(?, ?, ?)}"
       
        na_cmd.Parameters.Append param_bank_code
        na_cmd.Parameters.Append param_corp_id
        na_cmd.Parameters.Append param_return_status
       
        na_cmd.ActiveConnection = na_conn
        Set recset = na_cmd.Execute
       
        ......
       
        Set na_cmd = Nothing
       
        recset.Close
        Set recset = Nothing
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9912041
Change:
Set na_conn = CreateObject("ADODB.Connection")

To:
Set na_conn = New ADODB.Connection

Also change:
Public Function open_dbconnect() As Connection

To
Public Function open_dbconnect() As ADODB.Connection

Leon
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:wongchun
ID: 9932610
Are they different?
0
 
LVL 29

Accepted Solution

by:
leonstryker earned 250 total points
ID: 9932630
You are mixing Late and Early Binding terminology.  If you wish to use Early binding then establish a reference to ADO and declare as:

Dim na_conn As ADODB.Connection
Set na_conn = New ADODB.Connection

If you are using Late Binding.  Then:

Dim na_conn As Object
Set na_conn = CreateObject("ADODB.Connection")

In the declaration you are better off declaring objects exactly as they are. By declaring "open_dbconnect() As Connection" you may be limiting your methods since it is a different object.

Leon
0
 
LVL 1

Author Comment

by:wongchun
ID: 9970649
Thanks.

Daniel
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

896 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now