Streaming Print Job? フォローする

0
Avatar
Legacy Poster

Hello, can someone help to point me in the right direction as to how to stream a SQL query dataset as a single print job vs each iteration as a single print job (thus cutting after each label instead of one cut at end of stream of labels)?  There are 5 rows returned in this example and the printer cuts after each label is printed.  I would like for it to cut only once at end of the 5th record.

 

Bartender 2016 & SDK installed as trial version (Enterprise Automation) on Windows 2008 R2 SP1 web server (64bit).

Visual Studio 2013 ASP.NET  VB.NET WebForms

 

     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        
        Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("SeedTrackerConnectionString").ConnectionString)
                conn.Open()
               Dim selectCommand2 As New SqlCommand("SELECT STID, Label, UID, FORMAT(TimeStamp, 'MM/dd/yyyy', 'en-US') AS TimeStamp FROM SeedTracker WHERE UID=@UID", conn)
                selectCommand2.Parameters.AddWithValue("UID", "ahelbling")
                stDataReader = selectCommand2.ExecuteReader
                If Not stDataReader.HasRows Then
                    'no rows returned
                Else
                    'rows returned
                    'Dim arrList = New ArrayList()
                    Try
                        Using btEngine As New Engine() 
                            btEngine.Start()
                            Dim btFormat As Seagull.BarTender.Print.LabelFormatDocument = btEngine.Documents.Open("c:\inetpub\stbrutnell\LabelFiles\2016\IP_TEST.btw")
                            While stDataReader.Read()
                                sSTID = CType(stDataReader.Item("STID"), String)
                                btFormat.SubStrings.Item("STID").Value = sSTID
                                sLabel = CType(stDataReader.Item("Label"), String)
                                btFormat.SubStrings.Item("LABEL").Value = sLabel
                                sUID = CType(stDataReader.Item("UID"), String)
                                btFormat.SubStrings.Item("UID").Value = sUID
                                sTimeStamp = CType(stDataReader.Item("TimeStamp"), String)
                                btFormat.SubStrings.Item("TIMESTAMP").Value = sTimeStamp
                                btFormat.Print()
                                'arrList.Add(sSTID)
                            End While
                            btEngine.Stop() 
                        End Using 
                    Catch ex As Exception
                        response.write(ex)
                    End Try
                End If
                stDataReader.Close()
        End Using
 

    End Sub 

1 コメント

0
Avatar
Ian Cummings
モデレータ
コメントアクション Permalink

You need to assemble your data records into a temporary data file, like a CSV, and then have the BarTender document connect to that data file and print using it in a single print action.

ログインしてコメントを残してください。