Hello Rich,
Thanks for posting in the group and sharing the information here. I believe
it could help Crystal Report developers much here.
For the question, please try using the SetDataSource method to do it at
runtime.
Eg.:
myConn = new SqlConnection(" Server=.;Databa se=Northwind;In tegrated
Security=true;" );
SqlDataAdapter adapter = new SqlDataAdapter( "select EmployeeID, LastName,
Firstname, HireDate from employees",myCo nn);
adapter.Fill(my NorthwindDS,"Em ployees");
myNorthwindRepo rt.SetDataSourc e(myNorthwindDS );
crystalReportVi ewer1.ReportSou rce = myNorthwindRepo rt;
Hope that helps.
Best regards,
Yanhong Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
!From:
ri*******@allia ntenergy.com (Rick Thiel)
!Newsgroups: microsoft.publi c.dotnet.genera l
!Subject: Re: Crystal Report Unbound Fields
!Date: 15 Sep 2003 06:13:28 -0700
!Organization:
http://groups.google.com/
!Lines: 63
!Message-ID: <39************ **************@ posting.google. com>
!References: <39************ **************@ posting.google. com>
!NNTP-Posting-Host: 198.7.47.200
!Content-Type: text/plain; charset=ISO-8859-1
!Content-Transfer-Encoding: 8bit
!X-Trace: posting.google. com 1063631609 5918 127.0.0.1 (15 Sep 2003
13:13:29 GMT)
!X-Complaints-To:
gr**********@go ogle.com
!NNTP-Posting-Date: 15 Sep 2003 13:13:29 GMT
!Path:
cpmsftngxa07.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8
..phx.gbl!newsf eed00.sul.t-online.de!t-online.de!news-spur1.maxwell.s yr.edu!n
ews.maxwell.syr .edu!news-out1.nntp.be!pr opagator2-sterling!news-in-sterling.
newsfeed.com!pd 2nf1so.cg.shawc able.net!reside ntial.shaw.ca!s n-xit-03!sn-xit-
01!sn-xit-09!supernews.co m!postnews1.goo gle.com!not-for-mail
!Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.genera l:108219
!X-Tomcat-NG: microsoft.publi c.dotnet.genera l
!
!UPDATE: I emailed crystal about this subject and here is there response:
!
!Hello Rick,
!
!First I would like to thank you for using Answer By Emails (ABE) service.
!
!Unfortunately, unbound field is not supported in Crystal Reports for
!VS.NET.
!
!For information on using Crystal Reports for Visual Studio .NET with
!ADO.NET, go to 'http://support.crystal decisions.com/docs' and search for:
!'crnet_adonet. pdf'
!
!For a sample application demonstrating passing an ADO.NET dataset to a
!report, go to
http://support.crystaldecisions.com/download and search for:
!Vbnet_win_adod otnet.exe
!
!
!ri*******@alli antenergy.com (Rick Thiel) wrote in message
news:<39******* *************** ****@posting.go ogle.com>...
!> Hello,
!>
!> I am trying to build a Crystal report VisualStudio.NE T for an ASP.NET
!> application. I would like to build a report that doesn't connect to
!> any particular database at design time because I am planning to pass a
!> dataset to the report at runtime. From what I have read, it sounds
!> like unbound fields might be the answer. However, I am having trouble
!> figuring out how to bind these unbound fields to my dataset at
!> runtime.
!>
!> Any help would be greatly appreciated! thanks, --Rick
!>
!> //Here is the code I have so far...
!> ReportDocument crReportDocumen t = new ReportDocument( );
!>
!> //Grab the dataset from session
!> DataSet ds = (DataSet)Sessio n["CRDataset"];
!> DataTable dt = ds.Tables["MY_TABLE"];
!>
!> //load the report from disk
!> crReportDocumen t.Load(@"C:\Ine tpub\wwwroot\My App\Reports\MyS ummary.rpt");
!> crReportDocumen t.SetDataSource (dt);
!>
!> //*************** **************
!> // TODO: I have an unbound field named "UnboundString1 "
!> // I need to assign a column from the dataset to that field.
!> // Is that possible on an ASP.NET application
!> //*************** **************
!>
!> //set the options for saving the exported file to disk
!> DiskFileDestina tionOptions dfdOptions = new
!> DiskFileDestina tionOptions();
!> dfdOptions.Disk FileName = strPathFname;
!>
!> //set the exporting information
!> ExportOptions crExportOptions = new ExportOptions() ;
!> crExportOptions = crReportDocumen t.ExportOptions ;
!> crExportOptions .DestinationOpt ions = dfdOptions;
!> crExportOptions .ExportDestinat ionType =
!> ExportDestinati onType.DiskFile ;
!> crExportOptions .ExportFormatTy pe = ExportFormatTyp e.PortableDocFo rmat;
!>
!> //Export the report and write the file to the client browser
!> crReportDocumen t.Export();
!