Zum Hauptinhalt gehen

Suche

Suche

Check If A Label Is Using Database Field Or Screen Data

Kommentare

5 Kommentare

  • Avatar
    Ian Cummings
    Moderator
    Assuming that you are using the .NET SDK you can make use of the DatabaseConnection class to get details of any database that is connected to the label. See the BarTender Help system for a full reference with full code examples.

    [code]
    Public Sub Demo()
    ' Initialize a new BarTender print engine'
    Using btEngine As New Engine()
    ' Start the BarTender print engine'
    btEngine.Start()

    ' Initialize the format document'
    ' (create a format with query prompts to use this example)'
    Dim btFormat As LabelFormatDocument = btEngine.Documents.Open("C:\FormatWithQueryPrompts.btw")

    ' Print the name and type of each database connection'
    ' (foreach implicitly uses GetEnumerator)'
    For Each connection As DatabaseConnection In btFormat.DatabaseConnections
    Console.WriteLine(String.Format("Connection '{0}' is of type '{1}'", connection.Name, connection.Type))
    Next connection

    ' Close the current format without saving'
    btFormat.Close(SaveOptions.DoNotSaveChanges)

    ' Stop the BarTender print engine'
    btEngine.Stop()
    End Using
    End Sub
    [/code]
    0
  • Avatar
    Legacy Poster
    Hi,

    can we create query prompts on the fly?
    0
  • Avatar
    Legacy Poster
    Hi Ian,

    Thanks for your reply. My question is - is there a way, we can check if database fields have been used in a label? because what happens sometimes is the label might have a database connection set up but might not be using any database fields but only screen data. I need to check this through a program.

    Thanks
    0
  • Avatar
    Legacy Poster
    Slightly similar question, hopefully not too much off the topic. When the database gets disconnected (removed) from the label design, the objects are still linked to that data source. When I reconnect another database, although with the same structure, the fields do not work. But they still display that they are Database Fields.
    Is there any chance to show there warning, that the linked database field is not valid, or change the Data Source to Screen?
    0
  • Avatar
    Legacy Poster
    [quote name='Vlastimil Buzek' timestamp='1328007381' post='1634']
    Slightly similar question, hopefully not too much off the topic. When the database gets disconnected (removed) from the label design, the objects are still linked to that data source. When I reconnect another database, although with the same structure, the fields do not work. But they still display that they are Database Fields.
    Is there any chance to show there warning, that the linked database field is not valid, or change the Data Source to Screen?
    [/quote]

    I've found that if you change to an identically-structured but different database (or a different table within the same database), you have to go through and open up the Data Source tab each database field on the label (either double-click or right-click/properties), and just press 'OK'... you don't have to change anything, just open it and close it, as if it needs some confirmation! Any that you miss will just not display anything, as I've found to my cost.
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.