ByteScout BarCode Generator SDK - C# - Generate Barcodes from Database - ByteScout

ByteScout BarCode Generator SDK – C# – Generate Barcodes from Database

  • Home
  • /
  • Articles
  • /
  • ByteScout BarCode Generator SDK – C# – Generate Barcodes from Database

How to generate barcodes from database in C# and ByteScout Barcode SDK

How to code in C# to generate barcodes from database with this step-by-step tutorial

Every ByteScout tool contains example C# source codes that you can find here or in the folder with installed ByteScout product. What is ByteScout Barcode SDK? It is the robost library (Software Development Kit) that is designed for automatic generation of high-quality barcodes for printing, electronic documents and pdf. All popular barcode types are supported from Code 39 and Code 129 to QR Code, UPC, GS1, GS-128, Datamatrix, PDF417, Maxicode and many others. Provides support for full customization of fonts, colors, output and printing sizes. Special tools are included to verify output quality and printing quality. Can add generated barcode into new or existing documents, images and PDF. It can help you to generate barcodes from database in your C# application.

You will save a lot of time on writing and testing code as you may just take the C# code from ByteScout Barcode SDK for generate barcodes from database below and use it in your application. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Test C# sample code examples whether they respond your needs and requirements for the project.

Free trial version of ByteScout Barcode SDK is available for download from our website. Get it to try other source code samples for C#.

Try ByteScout Barcode SDK today: Get 60 Day Free Trial or sign up for Web API

Program.cs
      
using System.Data.OleDb; using Bytescout.BarCode; namespace GenerateFromDatabase { class Program { static void Main(string[] args) { // Create Barcode generator instance using (Barcode barcode = new Barcode()) { // Set barcode type to QR Code barcode.Symbology = SymbologyType.QRCode; // Create database connection using (OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=demodb.mdb;User Id=admin;Password=;")) { connection.Open(); // Create SQL query using (OleDbCommand command = connection.CreateCommand()) { command.CommandText = "SELECT title FROM Books"; OleDbDataReader dataReader = command.ExecuteReader(); // Iterate values and generate barcode images int i = 0; while (dataReader.Read()) { barcode.Value = dataReader.GetString(0); barcode.SaveImage(i + ".png"); i++; } } } } } } }

Try ByteScout Barcode SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

VIDEO

ON-PREMISE VERSION

Get 60 Day Free Trial or Visit ByteScout Barcode SDK page

Explore ByteScout Barcode SDK documentation

WEB API

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next