Skip to main content

Search

Search

Framework For Two Separate Database Connections And Queries

Comments

3 comments

  • Avatar
    Fernando Ramos Miracle

    Hello Adam,

     

    What you require can be done using both methods:

     

    1. In deed an option would be to use the already implemented database connection to query the database, and then use a VB script in a data entry control to query a second database and to load the resulting data into label objects or data sources.

     

    Attached you'll find an example you could use as reference. This sample contain a couple VB Scripts that do two things :

     
     a.    Fills a drop down list from an Excel spreadsheet.
     b.    Uses the choice selected in the drop down list to query the database again to retrieve records that match the selection, and loads that data into a label object.
     
    2.1. A second option would be to query your two databases directly from your ERP system, and then output the resulting data for BarTender to print it. This could be done for example using our middle ware application Commander. This way your ERP could export a simple text file with all the required data (already from the two databases) which Commander would automatically detect and produce the print job with all the required data. For more information please read the below white papers:
     
    *This option would require that your ERP prompts the user for all the required data (for both queries), as your application would be the one filtering the database instead of BarTender.
     
    2.2. If you wish to fully automate BarTender through our .NET SDKs you would still need to perform one custom database connection to one of the two databases as BarTender only supports one database connection per document. Which means that you could prompt one query designed directly from your ERP, and the other using our supported query prompt for the second database.
     
    Then, with all the correct data already at your application's disposal (at least the one produced by your ERP's own query, as the other query would have loaded the information automatically on the document) load the appropriate data to the label using the "SubString" class.
     
    You'll find detailed information in our help documentation.
     
    Best regards.
    0
  • Avatar
    Legacy Poster

    Fernando,

     

    Thanks so much for the detailed response. I will study the attached example and see what I can come up with. 

     

    I think eventually an ERP Macro and integration with Commander is the route that I want to go. It would be very nice to just have users click a button in the ERP suite, enter the data, then have the label generate automatically. Until I have time to develop that, I'll give the VB scripting in Bartender a whirl.

     

    Adam

    0
  • Avatar
    Legacy Poster

    Another way of fixing this problem is creating a database "View" that combines the information from your two databases and likely multiple tables.  You will have to create the view with the record for the CO# and Line # whether it is a "made to order" item or stock item.  Since you say a Join doesn't work then maybe UNION the two queries - which should work as long as the columns from each query are the same.

     

    I do something similar quite often since Bartender label formats cannot change their connection string on the fly.  Not sure if you have the ability to create something like this in your database but I would say that this is a possible option for you.  

     

    If you need more guidance on this, let me know.  

    0

Please sign in to leave a comment.