How To Set A Sql Statement To Labelformatdocument Object? Follow

0
Avatar
Legacy Poster

Hi,

 

      I refer the BarTender .net  sdks docs, the sample code is :

 

            ((OLEDB)btFormat.DatabaseConnections[0]).SQLStatement = SQL; 

 

       But in my visual studio envirment, can't find the "OLEDB" class,  even using namespace System.Data &

 

      System.Data.OleDb .

 

       I  used Visual Studio 2010 professional, in WINDOWS 7 X64 ULTIMATE. 

 

       Anybody  can tell me how to do ?  Thanks a lot~~!

2 comments

0
Avatar
Domingo Rodriguez
Moderator
Comment actions Permalink

From BarTender's Help, you can see the instructions needed for compiling your first .NET SDK application:

 

Beginning a Visual Studio Project with the Print SDK

 

To begin a BarTender Print SDK project in Visual Studio 2005 or higher:

 



  1. From the File menu, select New and click
    Project.


  2. In the Project types panel, under either the Visual
    C#
    or the Visual Basic node, select Windows.


  3. In the Templates panel, select Windows
    Application
    .


  4. Name the project and click OK.

 

After the project is created, add a reference to
Seagull.BarTender.Print.

 



  1. In the Solution Explorer panel, right-click
    on the References node and select Add
    Reference
    from the context menu.


  2. In the Add Reference window, select the
    .NET tab, select Seagull.BarTender.Print, and
    click OK.

 

Make sure the project is able to build and compile by pressing
Ctrl+Shift+B. If successful, you are ready to begin your first
BarTender Print SDK project.

 

You could now set your OLEDB statement by using the following code (for C#.Net):

 

string SQL = "SELECT `Calories` FROM `NutritionInformation`";

Engine btEngine = new Engine();

LabelFormatDocument btFormat = btEngine.Documents.Open(@"C:\NutritionLabel.btw");

((OLEDB)btFormat.DatabaseConnections[0]).SQLStatement = SQL;

 

 

Does this help or will you still be stuck?

0
Avatar
Legacy Poster
Comment actions Permalink

I found must add reference the namespace "Seagull.BarTender.Print.Database" ( NOT the "Seagull.BarTender.Print") so that to find the "OLEDB" class. 

 

Thank you for you help~~!!

Please sign in to leave a comment.