Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET1.0 .NET2.0 .NET3.0 VB8.0 VB , +
is it possible to display values from data reader to crystal report in vb.net??
my code is
 
Imports System.Data
Imports Oracle.DataAccess.Client ' ODP.NET Oracle managed provider
Imports Oracle.DataAccess.Types
 

Dim oradb As String = "Data Source=orcl;User Id=hr;Password=hr;"
Dim conn As New OracleConnection(oradb)
conn.Open()
Dim cmd As New OracleCommand
cmd.Connection = conn
cmd.CommandText = "select department_name from departments where department_id = 10"
cmd.CommandType = CommandType.Text
Dim dr As OracleDataReader = cmd.ExecuteReader()
dr.Read()
Label1.Text = dr.Item("department_name")
conn.Dispose()
 

here instaed of label i want to show the result set in crystal report?
I have created one crystal report and crystal report viewer.
how can i do this?
Posted 21-May-13 22:28pm
Kavitha_b1.4K
Edited 21-May-13 23:48pm
v3
Comments
Kavitha le at 22-May-13 4:48am
   
Anybody please help

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can use the following code
You can first convert the datareader to datatable
 
DataTable dt = new DataTable();
dt.Load(dr);
 
// Then you use the use that directly to the repory
ReportDocument report = new ReportDocument();
report.Load(Server.MapPath("~/Reports/bydos.rpt"));//Your report Page
report.SetDataSource(dt);
CrystalReportViewer1.ReportSource = report;
CrystalReportViewer1.DataBind();
 
You can also refer to the following Links
http://forums.asp.net/t/1677080.aspx/1[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 505
1 Maciej Los 309
2 BillWoodruff 174
3 /\jmot 160
4 Suraj Sahoo | Coding Passion 160
0 OriginalGriff 8,654
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,229
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 22 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100