Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
| Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 19th, 2008, 02:56 PM
Registered User
 
Join Date: Feb 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Enable crystal report datasource dialogbox

hi, i created a form with a crystal report viewer and in the below code i'm creating an instance of the report and passing in the reportsource.
Dim myform As New frmReport
        Dim ReportPath As String = ini.ReadString("DataSource", "GENLEDCASHDEP")
        myform.CRVreports.ReportSource = ReportPath

what i would like to do is allow the user to select the datasource for the report from the list of system datasources they have on their system. How can this be done
I've been searching and didn't find any help.

Owen, Programmer
  #2 (permalink)  
Old November 21st, 2008, 07:11 AM
Registered User
 
Join Date: Nov 2008
Location: delhi, delhi, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

1.Make a DSN for connection in Crystal Report.
2.Right Click on your projent in solution Explorer
3.Add New Item.Select CrystalReport.rpt
4 create new connection from the DataSource Like Access/Excel(DAO),ADO.NET etc.
You selected one datasource out of one acording to your datasource which you want.
5 you justmake a choice of your dsn
6Now your crystal report has Datasource which you want to use in code bind.And you can bind your report.

  #3 (permalink)  
Old November 21st, 2008, 07:44 AM
Registered User
 
Join Date: Nov 2008
Location: delhi, delhi, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

this may also help you in code behind
            customerReport = new ReportDocument();
            string reportPath = Server.MapPath("CrystalReport.rpt");
            customerReport.Load(reportPath);


            string connstr = "DSN=vipin;UID=user;Pwd=pwd;Unicode=True;Persi st Security Info=True;";
            OdbcConnection conn = new OdbcConnection(connstr);
            conn.Open();
            string searchstring = "SELECT costcentername,costcentercode FROM cstcenter where costcentercode in(SELECT distinct CostCenter FROM transac) ";
            OdbcDataAdapter adapter = new OdbcDataAdapter(searchstring, conn);

            DataSet dataSet = new DataSet();

            adapter.Fill(dataSet, "cstcenter");
            customerReport.SetDataSource(dataSet);
            CrystalReportViewer1.ReportSource = customerReport;




Similar Threads
Thread Thread Starter Forum Replies Last Post
Change datasource of crystal report at runtime check123 Pro VB 6 1 March 21st, 2008 05:45 AM
change Datasource of a crystal report at run time tiyyob Pro VB 6 1 February 17th, 2007 06:05 AM
how to add xsd file as a DataSource for the report Mojmir Reporting Services 0 March 9th, 2006 05:58 AM
Crystal datasource changing from Access to SQL and tabilda Pro VB 6 4 November 24th, 2005 09:57 AM
XML as datasource for report Itai Crystal Reports 0 June 2nd, 2005 09:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.