Click here to Skip to main content
11,715,043 members (63,038 online)
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 21:28pm
Edited 21-May-13 22: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 Sergey Alexandrovich Kryukov 530
1 Richard MacCutchan 275
2 Maciej Los 259
3 ManasKumarM 155
4 Frankie-C 115
0 Sergey Alexandrovich Kryukov 775
1 CHill60 415
2 Richard MacCutchan 405
3 Maciej Los 389
4 OriginalGriff 320


Advertise | Privacy | Mobile
Web01 | 2.8.150901.1 | Last Updated 22 May 2013
Copyright © CodeProject, 1999-2015
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