Hello,
I want my data from datatable printing on paper or pdf, using PrintDocument.
Can this?
Consolecode:
Attachment 94085
I want my data from datatable printing on paper or pdf, using PrintDocument.
Can this?
Consolecode:
Code:
Imports System.Data.SqlClient
Imports System.Drawing.Printing
Module mDatabase
Sub Main()
Starter()
Dim grondstoffen = laadGrondStoffen()
For Each col As DataColumn In grondstoffen.Columns
Console.Write(String.Format("{0,-20}", col.ColumnName))
Next
Console.WriteLine()
For Each row As DataRow In grondstoffen.Rows
For Each item In row.ItemArray
Console.Write(String.Format("{0,-20}", item))
Next
Console.WriteLine()
Next
Console.ReadLine()
End Sub
Private Function laadGrondStoffen() As DataTable
Const query As String = "SELECT GrondstofID, GrondstofNaam, GrondstofPrijs FROM tblGrondstoffen"
Dim result As New DataTable("GrondStof")
Using CN As New SqlConnection(fPad.Constring)
Using adapter As New SqlDataAdapter(query, CN)
adapter.Fill(result)
End Using
End Using
Return result
End Function