Click here to Skip to main content
15,903,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Imports System.Data
Imports System.Data.OleDb

Public Class Print
Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Billing\bill.mdb")
Dim cmd As New OleDbCommand
Dim dap As New OleDbDataAdapter
Dim ds As New DataSet
Private Sub Print_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str2 As String

str2 = "SELECT customer.*, item.* FROM customer INNER JOIN item ON customer.billno =item.billno"
cmd = New OleDbCommand(str2, cnn)

dap = New OleDbDataAdapter(cmd)
ds = New DataSet

dap.Fill(ds)




Dim obj As New crv
obj.SetDataSource(ds.Tables(0))
CrystalReportViewer1.ReportSource = obj


End Sub


End Class
Posted

 
Share this answer
 
v2
Comments
Navi Sandhu 20-Jan-14 7:46am    
thanku sir it is very useful fro me
thatraja 20-Jan-14 7:48am    
welcome
Navi Sandhu 20-Jan-14 7:48am    
I m workoing on sales system and i want to access details from sales table a particular bill no s details bt i access the full table report so hoe can i access a particular bill no s details in crystal report viwer
thatraja 20-Jan-14 7:56am    
Check updated answer
Navi Sandhu 20-Jan-14 8:10am    
but Sir i m using Access database in VB.net2010
You'll find crystal report in visual studio toolbox, Add new crystal report by drag and drop from the toolbox. create crystalreport obj inside that reportviewer, call obj on page load.
and from which page you want to call the print function create obj of the report viewer and call it. Here is an example

Reportviewer obj = new Reportviewer();
obj.dt = tbl;//tbl is a datatable which stores the value which you want to print
obj.Show();


and in the reportviewer pageload
CrystalReport1 crt = new Reports.CrystalReport1();
crt.Database.Tables[0].SetDataSource(dt);
crystalReportViewer1.ReportSource = crt;
 
Share this answer
 
v2
Comments
Navi Sandhu 20-Jan-14 7:25am    
sir i want to access data from 2 tables at a time
sahabiswarup 27-Jan-14 12:53pm    
You can create one view in the database, of generate one datatable writting one join sql and use that. Hope this helps.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900