Sign In  Sign Up Live-Chat

barcode

Last post 05-26-2008, 6:15 AM by saqib.razzaq. 1 replies.
Sort Posts: Previous Next
  •  05-26-2008, 3:27 AM 128611

    barcode

    Hi Sarfraz,

    Can you help me in barcoding the existing database in SQL..where by at the moment I have procedures to generate automatically 10 digit unique registration number I want to also generate barcode for each customer with different barcode…and the barcode has to be in format Code128 and with check digits and tab character whereby a tab character is used after UNWAC in barcode and then 10 digit long number something like this UNWAC TAB 0123456789

    Can you help me out here with this and if we can have a trial run with our database we will purchase your software…

    Thanks

    Regards,

    Vishal
    Database Administrator / Graphic Designer
    p + 679 3275040
    f + 679 3275053
    e vishal@getunwired.com.fj
    w www.unwired.com.fj


    This message was posted using Email2Forum by salman.sarfraz.
     
  •  05-26-2008, 6:15 AM 128627 in reply to 128611

    Re: barcode

    Hi Vishal,

    Thanks for considering Aspose.

    Please see the following code that reads the customer data from the SQL database and generates the barcode for each customer. It generates BarCode for "CustomerCode" field of "Customer" table. I have tested it by setting the customer code to "UNWAC TAB character 0123456789" in the DB. Please let me know if it works for you or I can be of further assistance.

    // open connection to DB

    SqlConnection conn = new SqlConnection("Server=server;Database=DBName;Trusted_Connection=True;");

    conn.Open();

    // select records from customer table and open the reader

    SqlCommand cmd = new SqlCommand("SELECT * FROM Customer", conn);

    SqlDataReader reader = cmd.ExecuteReader();

    string strCustomerCode = "";

    // iterate through all the records in the reader

    while (reader.Read())

    {

    // get the customer code in variable

    strCustomerCode = reader["CustomerCode"].ToString();

    // create the barcode object and set the codetext and symbology

    BarCodeBuilder barcode = new BarCodeBuilder(strCustomerCode, Symbology.Code128);

    // enable escape sequences to be encoded e.g. \n, \t etc

    barcode.EnableEscape = true;

    // generate the barcode image

    barcode.GenerateBarCodeImage();

    // save in some file. You can also save in stream

    barcode.Save(@"c:\temp\customer.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);

    }

    // clean up DB resources

    reader.Close();

    cmd.Dispose();

    conn.Dispose();


    Best Regards,

    Saqib Razzaq
    Support Developer
    Aspose Guangzhou Team

     
View as RSS news feed in XML