Check If A Label Is Using Database Field Or Screen Data Seguir

0
Avatar
Legacy Poster

Hi,

Is it possible to check if a label is using database field? through a program and not manually?

thanks

5 comentarios

0
Avatar
Ian Cummings
Moderador
Acciones de comentarios Permalink

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
Acciones de comentarios Permalink

Hi,

can we create query prompts on the fly?
0
Avatar
Legacy Poster
Acciones de comentarios Permalink

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
Acciones de comentarios Permalink

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
Acciones de comentarios Permalink

[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.

Iniciar sesión para dejar un comentario.