Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Using Visual Dataflex to Access QB DataSearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC v7 Forum

 New Topic 
 
 Post Reply 
[1]  
 Using Visual Dataflex to Access QB Data 
 Author   Message 
  James Stone 
  
 Group: Members 
 Posts: 1 
 Joined: 2006-12-02 
 Profile
 Posted : 2006-12-08 07:18:14

Has anyone ever done this before?  Any source for test data available?  I have VDF11 and can see the data using builder and explorer, but when I write a very simple program, the OPEN QBCUST file which is linked to the odbc_drv driver and the int file attempts to open the file, I get status 72, file not open with a RECUM_SUPPORT error.

I was able to more than that in VDF7.  VDF7 actually let me open the file and find through the data.  I'm using VDF11 now since I thought I wiould have better success.  The QODBC manual leaves a lot out.  Specifically, how do I send a INSERT INTO command (sql script command per qodbc docs) to the odbc driver?  Any ideas.  This forum looks like very few have attempted this.  Somebody must have done it. 

Lastly, is there some control or automation library I must use to gain access to the driver?  If so, any tips on how to use it.  I'm getting frustrated trying to get this to work at all.  I just need to be able to add a customer record into the customer file and save it successfully.

Thanks ahead of time
James Stone
Stone Software

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-12-10 16:14:39

Visual DataFlex 11.x allows for the QODBC tables to be supported through the ODBC_DRV that's part of the Studio with alpha numeric (ASCII) unique identifiers (record_number) . The normal method is to open the Studio and the workspace, select Database Builder and using the Database pulldown "Connect to ODBC Database...", the select either the table you're interested in or the entire database. The wizard will then create the DDs for you that you can use within the Studio as regular tables.

As far as using Embedded SQL, here are a couple of component examples you can use within a view:

/ This view demonstrates the topics in Chapter 3 of
// the Embedded SQL User's Guide:
// - Shows the message interface and the command interface
// - Shows the query:
//    Select ListID, Name, FullName from customer where IsActive = 1;

Use Windows.pkg
Use ODBC_DRV.pkg
Use SQL.pkg

/* DO NOT REMOVE THIS LINE: IDE GENERATED CODE WILL GO HERE */
   
#Replace CS_CONNECT "DSN=QuickBooks Data"
#Replace CS_QUERY   "Select ListID, Name, FullName from customer where IsActive = 1;"

// Procedure: MessageInterface
// Purpose  : Execute the query and show its results using the message interface
Procedure MessageInterface
    String sID sName sFullName sLineFeed
    Handle hoSQL hDbc hStmt
    Integer iFetchResult

    Move (Character(10)) To sLineFeed

    //*** The SQL handle manager object
    Object oSQLHandler Is A cSQLHandleManager
        Move Self To hoSQL
    End_Object // oSQLHandler

    //*** Connect to the database server
    Send SQLSetConnect Of hoSQL ODBC_DRV_ID CS_CONNECT
    Get SQLConnect     Of hoSQL "" "" To hDbc
    If (hDbc <> 0) Begin
        //*** Open a statement
        Get SQLOpen Of hDbc To hStmt
        If (hStmt <> 0) Begin
            //*** Execute the statement, we do it only once so use direct
            //*** execution
            Send SQLExecDirect Of hStmt CS_QUERY

            //*** Traverse the result set
            Repeat
                Get SQLFetch Of hStmt To iFetchResult
                If (iFetchResult <> 0) Begin
                    Get SQLColumnValue Of hStmt 1 To sID
                    Get SQLColumnValue Of hStmt 2 To sName
                    Get SQLColumnValue Of hStmt 3 To sFullName
                    Send Insert Of oResults (sID+", "+sName+", "+sFullName+sLineFeed+sLineFeed)
                End
            Until (iFetchResult = 0)
            Send SQLClose Of hStmt
        End
        Send SQLDisconnect Of hDbc
    End

    //*** Destory the SQL handle manager object
    Send Destroy_Object Of hoSQL
End_Procedure // MessageInterface

// Procedure: CommandInterface
// Purpose  : Execute the query and show its results using the command interface
Procedure CommandInterface
    String sID sName sFullName sLineFeed
    Handle hoSQL hDbc hStmt

    Move (Character(10)) To sLineFeed

    //*** Connect to the database server
    SQLSetConnect ODBC_DRV_ID CS_CONNECT
    SQLConnect To hDbc
    If (hDbc <> 0) Begin
        //*** Open a statement
        SQLOpen hDbc To hStmt
        If (hStmt <> 0) Begin
            //*** Execute the statement, we do it only once so use direct
            //*** execution
            SQLExecDirect hStmt CS_QUERY

            //*** Traverse the result set
            Repeat
                SQLFetch hStmt To sID sName sFullname
                If (SQLResult <> 0) Begin
                    Send Insert Of oResults (sID+", "+sName+", "+sFullName+sLineFeed)
                End
            Until (SQLResult = 0)
            SQLClose hStmt
        End
        SQLDisconnect hDbc
    End
End_Procedure // CommandInterface

Procedure TestMessageInterface
    Send Delete_Data Of oResults
    Send MessageInterface
End_Procedure  // TestMessageInterface

Procedure TestCommandInterface
    Send Delete_Data Of oResults
    Send CommandInterface
End_Procedure  // TestCommandInterface

 

The forum contains many examples of the INSERT statements you can use through the Visual DataFlex command interface. For example, see: How do I add customers? 

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to