如何使用对象数据源在Crystal Report中工作?

时间:2010-11-13 04:49:23

标签: winforms objectdatasource crystal-reports-2008

如何使用对象数据源在Winforms Crystal Report中工作?

到目前为止,我已找到web-links直接将Crystal Report与数据集或数据库一起使用。

有人可以告诉我如何像this那样做吗?

2 个答案:

答案 0 :(得分:0)

和以前一样......

reportDocument.SetDataSource(List1);

答案 1 :(得分:0)

        <CR:CrystalReportViewer ID="crvmyDataReport" runat="server" 
            ReportSourceID="crsmyData" EnableDatabaseLogonPrompt="False" DisplayGroupTree="False" 
            EnableParameterPrompt="False" ReuseParameterValuesOnRefresh="True" 
            BorderStyle="Solid" BorderColor="Black" BorderWidth="1px" />
        <br />
        <CR:CrystalReportSource ID="crsmyData" runat="server">
            <Report FileName="myData.rpt">
                <DataSources>
                    <CR:DataSourceRef DataSourceID="odsmyData" TableName="myData" />
                </DataSources>
            </Report>
        </CR:CrystalReportSource>
        <asp:ObjectDataSource ID="odsmyData" runat="server" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="myDataQuery" 
            TypeName="myDataAppTableAdapters.myDataTableAdapter">
            <SelectParameters>
                <asp:ControlParameter ControlID="tb1" ConvertEmptyStringToNull="False" 
                    DbType="String" Name="p1" PropertyName="Text" />
                <asp:ControlParameter ControlID="tb2" ConvertEmptyStringToNull="False" 
                    DbType="String" Name="p2" PropertyName="Text" />
                <asp:ControlParameter ControlID="tb3" ConvertEmptyStringToNull="False" 
                    DbType="String" Name="p3" PropertyName="Text" />
                <asp:ControlParameter ControlID="ddl1" ConvertEmptyStringToNull="False" 
                    DbType="String" Name="p4" PropertyName="SelectedValue" />
            </SelectParameters>
        </asp:ObjectDataSource>