I am trying to printbarcodes but my rdlc report just loops endlessly
please help
Private Sub ReportBarcode2()
ReportViewer1.ProcessingMode = ProcessingMode.Local
Dim dsCustomers As Customersdataset = GetDatad200("SELECT * FROM tbl_BarCodes")
Dim datasource As ReportDataSource = New ReportDataSource("DataSet1", dsCustomers.Tables(0))
ReportViewer1.Visible = True
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(datasource)
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/BarcodeNew.rdlc")
ReportViewer1.LocalReport.Refresh()
End Sub
Public Function GetDatad200(ByVal query As String) As Customersdataset
Dim conString As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
Dim cmd As SqlCommand = New SqlCommand(query)
Using con As SqlConnection = New SqlConnection(conString)
Using sda As SqlDataAdapter = New SqlDataAdapter()
cmd.Connection = con
sda.SelectCommand = cmd
Using dsCustomers As Customersdataset = New Customersdataset
sda.Fill(dsCustomers, "DataTable1")
Dim dt As DataTable = dsCustomers.Tables("DataTable1")
For i As Integer = 0 To (dsCustomers.DataTable1).Rows.Count - 1
dsCustomers.DataTable1.Rows(i)("Qrcode") = GenerateBarcode(((dsCustomers.DataTable1).Rows(i)("Barcode").ToString()))
Next
Return dsCustomers
End Using
End Using
End Using
End Function
Private Function GenerateBarcode(ByVal qrmsg As String) As Byte()
Dim barCode As String = qrmsg
Using bitMap As Bitmap = New Bitmap(barCode.Length * 40, 80)
Using graphics As Graphics = graphics.FromImage(bitMap)
Dim oFont As Font = New Font("IDAutomationHC39M Free Version", 16)
Dim point As PointF = New PointF(2.0F, 2.0F)
Dim blackBrush As SolidBrush = New SolidBrush(Color.Black)
Dim whiteBrush As SolidBrush = New SolidBrush(Color.White)
graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height)
graphics.DrawString("*" & barCode & "*", oFont, blackBrush, point)
End Using
Using ms As MemoryStream = New MemoryStream()
bitMap.Save(ms, ImageFormat.Png)
Return ms.ToArray()
End Using
End Using
End Function