Advertisement

05.27.2008 at 10:57PM PDT, ID: 23437144
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

What's the problem with ADO command with adAsyncExecute

Asked by nds_rahulmistry in VB Database Programming, Oracle 10.x, VB Objects

Tags: , , , ,

I am using VB6 as front-end and Oracle 10g as back-end.

I have a stored procedure in Oracle to generate Stock as on Given Date. The stored procedure is as following :

Oracle Side

Create or Replace Procedure GENERATE_BOOK_STOCK ( argTransDate DATE, argBookStockName VARCHAR2(50), argBookStockDate DATE, argBookStockRemarks VARCHAR2(250), argUserName VARCHAR2(15) )
IS
TID NUMBER;
BEGIN
      SELECT BOOK_STOCK_SEQ.nextval INTO TID FROM DUAL;

      INSERT INTO BOOK_STOCK_HEADER (TRANS_ID, TRANS_DATE, BOOK_STOCK_NAME, BOOK_STOCK_DATE, REMARKS, USER)
      SELECT TID, argTransDate, argBookStockName, argBookStockDate, argBookStockRemarks, arguserName from DUAL;

      INSERT INTO BOOK_STOCK(TRANS_ID, PRODUCT_ID, PLANT_ID, BATCH_ID, STOCK_QTY, UNIT_ID)
      SELECT TID, PRODUCT_ID, PLANT_ID, BATCH_ID, SUM(IN_FLOW - OUT_FLOW) AS STOCK_QTY, UNIT_ID
      FROM VU_LEDGER WHERE TRANS_DATE <= argBookStockDate
      GROUP BY TID, PRODUCT_ID, PLANT_ID, BATCH_ID, UNIT_ID;

      COMMIT;
END;



Visual Basic Side

I am using a Data Access Class called clsDAL. The class contains a function to execute Oracle Stored Procedure.
In my Form I have declared an ADODB recordset using WithEvents so that I can have more control.
I am executing the stored procedure asynchronusly so that it will execute in background and will not block my VB Application.



In the Form

dim cDAL as clsDAL
Private WithEvents rstBS As ADODB.Recordset      'To hold Book Stock Recordset


Private Sub Form_Load()
    Set cDAL = New clsDAL
End Sub


Private Sub cmdGenerateBookStock_Click()
      Dim CommandText As String
      CommandText =       "{CALL AURAMRP.GENERATE_BOOK_STOCK(SYSDATE,'" & BookStockName.Text & _
                  "', '" & DTPicker1.Value & "', '" & Remarks.Text & "','" & USERID & "'}"
      Set rstBS = cDAL.ExecuteStoredProcedure(CommandText)

      'THIS RECORDSET IS USED FOR FURTHER PROCESSING
End Sub


Private Sub rstBS_FetchComplete(ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
          MsgBox "Completed"
End Sub


In the class clsDAL


Public Function ExecuteStoredProcedure(ByVal CommandText As String) As ADODB.Recordset
    Dim cmd As New ADODB.Command
    cmd.ActiveConnection = dbCnn            'dbCnn is pre-defined valid connection
    cmd.CommandText = CommandText      
   
    'if I am using :   Set ExecuteStoredProcedure = cmd.Execute (, , adAsyncExecute),
    'it is not executing the command - it is not giving any error - and the bookstock is also not generated

    cmd.Execute , , adAsyncExecute            
   
    Set cmd = Nothing
End Function


I am not getting the message through my form function rstBS_FetchComplete.Start Free Trial
[+][-]05.29.2008 at 07:46AM PDT, ID: 21669606

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: VB Database Programming, Oracle 10.x, VB Objects
Tags: Microsoft, Visual Basic, 6, Calling Oracle Stored Procedure Asynchronusly, Visual Basic 6
Sign Up Now!
Solution Provided By: sdstuber
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628