i scan my invoice and i had 5 column item_no ,descrption ,qty,unit price, total Amount and ihave 20 rows i need to trans rows to excel file or .txt
i need to help to make programm by vb.net or asp.net :
scan the invoice then send data rows to table invoice It has the same columns invoice of sale
item_no ,descrption ,qty,unit price, total Amount sql server 2008

if impossible or

make programm to scan the invoice then send data all rows to excel or .txt

Express is very important please help if possible

Dani AI

Generated

For : the right approach depends on what "scan" means in practice. If each invoice row is encoded (barcode or machine-readable PDF) the job is straightforward; if the invoice is a photographed or scanned image you need an OCR/extraction step and a small verification UI. As noted, OCR itself is a solved-but-tricky problem — use an existing OCR engine (Tesseract or a commercial OCR/API) and focus on parsing, validation and load rather than writing OCR from scratch.

Recommended workflows

  • Barcode or keyboard-wedge scanners: capture values directly into a form and save rows to a DataTable, then export.
  • Digital PDFs with selectable text: extract text with a PDF library and parse the tabular area into rows.
  • Scanned images: preprocess (300 DPI, deskew, crop, binarize), run OCR, then parse lines into columns using templates or regex. Add a quick review screen for low-confidence rows.

Practical VB.NET snippets (schema: item_no, description, qty, unit_price, total_amount)

' Build DataTable (populate it from OCR/scan/parser)
Dim dt As New DataTable()
dt.Columns.Add("item_no", GetType(String))
dt.Columns.Add("description", GetType(String))
dt.Columns.Add("qty", GetType(Integer))
dt.Columns.Add("unit_price", GetType(Decimal))
dt.Columns.Add("total_amount", GetType(Decimal))

' Fast load into SQL Server 2008
Using cn As New System.Data.SqlClient.SqlConnection("Server=SERVER;Database=DB;Integrated Security=True;")
  cn.Open()
  Using bcp As New System.Data.SqlClient.SqlBulkCopy(cn)
    bcp.DestinationTableName = "dbo.invoice"
    bcp.ColumnMappings.Add("item_no", "item_no")
    bcp.ColumnMappings.Add("description", "description")
    bcp.ColumnMappings.Add("qty", "qty")
    bcp.ColumnMappings.Add("unit_price", "unit_price")
    bcp.ColumnMappings.Add("total_amount", "total_amount")
    bcp.WriteToServer(dt)
  End Using
End Using
' Export DataTable to CSV
Using sw As New IO.StreamWriter("C:\temp\invoice_export.csv", False, System.Text.Encoding.UTF8)
  ' header
  For i As Integer = 0 To dt.Columns.Count - 1
    If i > 0 Then sw.Write(",")
    sw.Write("""" & dt.Columns(i).ColumnName & """")
  Next
  sw.WriteLine()
  For Each r As DataRow In dt.Rows
    For i As Integer = 0 To dt.Columns.Count - 1
      If i > 0 Then sw.Write(",")
      sw.Write("""" & r(i).ToString().Replace("""", """""") & """")
    Next
    sw.WriteLine()
  Next
End Using

Troubleshooting notes: enforce numeric parsing and culture (decimal separators), store raw OCR text for corrections, reject rows below a confidence threshold, test with many invoice samples, and prefer template-based extractors if the invoice layout is consistent. For small volumes, parameterized INSERTs are fine; for bulk imports use SqlBulkCopy as shown.

Recommended Answers

All 3 Replies

this is first time i work whith this code pls help me

What do you mean by scan?

  1. Barcode? Get a barcode reader and write a frontend to catch the input and more.
  2. A printed page? That's OCR and you will not be writing OCR code. You might scan this with a camera/scanner then push it through image processing apps to get it ready to see what TESSERACT (see google) can read out of the scan. After that you write more code to pick through the text results.

Bottomline. You will be writing code. You won't be writing OCR code if you don't have years to develop this.

Well bass, a -1 for asking you a few questions and sharing a few ways? If that's a question in the comments, that belongs in a reply.

If that was a question the the comment, then answer is yes. A program (almost always custom) can do that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.