Change Sql-Statement In .net Sdk
Hi folks,
after years of using Bartender with COM, I try to upgrade my programs to .NET SDK (C#). I have a (maybe) simple question.
I have to change the SQL-Statement before printing. In COM I did a simple: BTFormat.InputDataFileSetup.OLEDB.SQLStatement = SQLCommand;
But I have not find a possibility to change the SQL-String in .NET SDK.
I will be thankful for any suggestions !!
Best regards from germany
Stalle
after years of using Bartender with COM, I try to upgrade my programs to .NET SDK (C#). I have a (maybe) simple question.
I have to change the SQL-Statement before printing. In COM I did a simple: BTFormat.InputDataFileSetup.OLEDB.SQLStatement = SQLCommand;
But I have not find a possibility to change the SQL-String in .NET SDK.
I will be thankful for any suggestions !!
Best regards from germany
Stalle
0
-
I copied this from BarTender's "Automating BarTender>Automation with BarTender .NET SDKs>BarTender .NET Print SDK>Getting Started>How To: Automate Database Printing" help topic:
When using an OLE DB or ODBC database connection, custom SQL statements may be used to perform record filtering when data browsing or to select database records at print time. To apply custom SQL statements, use the SQLStatement property.
The following code demonstrates how to set a custom SQL statement when using an OLE DB database connection.
In C#:
string SQL = "SELECT `Calories` FROM `NutritionInformation`"; Engine btEngine = new Engine(); LabelFormatDocument btFormat = btEngine.Documents.Open(@"C:\NutritionLabel.btw"); ((OLEDB)btFormat.DatabaseConnections[0]).SQLStatement = SQL;
In VB:
Dim SQL As String = "SELECT `Calories` FROM `NutritionInformation`" Dim btEngine As New Engine() Dim btFormat As LabelFormatDocument = btEngine.Documents.Open("C:\NutritionLabel.btw") CType(btFormat.DatabaseConnections(0), OLEDB).SQLStatement = SQL
By setting this property, the custom SQL statement will be used rather than the SQL statement set inside of BarTender.
0
Please sign in to leave a comment.
Comments
1 comment