本文介绍了不在水晶报表中显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我的报告有一点问题,问题是我有一个
datagridview中的数据.然后我将这些信息导入到
水晶报表,但时间数据未出现在相应的列中.

让我给您看一个图像来说明这种情况:




我使用的代码是:

1)将datagridview源分配给全局数据集变量:

this.dataGridView2.DataSource = detaDs.Tables["dt"];
dataReport = new DataSet();
dataReport = detaDs;

2)单击"Imprime"按钮,然后打开带有报表对象的Windows窗体,并执行所有操作以将数据导入报表.

new TarjeteroSharp.Form3(this.dataReport).Show();

Hello everybody again!

I have a little problem with my report, the problem is that I have a
data in a datagridview. and next I import this information in to a
Crystal report but the time data do not appear in the repective column.

Let me show you a image to illustrate this case:




the code that i use is:

1) asign the datagridview source to a global dataset variable:

this.dataGridView2.DataSource = detaDs.Tables["dt"];
dataReport = new DataSet();
dataReport = detaDs;

2) Click button "Imprime" next I open a windows form with the report object and i make all operations to import the data into a report.

new TarjeteroSharp.Form3(this.dataReport).Show();

public Form3(DataSet myData)
        {
            InitializeComponent();
            myDataGlobal = myData;

            object result = TarjeteroSharp.WaitWindow.Show(this.workerMethod2);
            try { System.Console.Out.WriteLine(result.ToString()); }
            catch { System.Console.Out.WriteLine("No se puede imprimir result2"); }

            this.crystalReportViewer1.ReportSource = rpt1;
            this.crystalReportViewer1.Refresh();
            myData.Dispose();
            myDataGlobal.Dispose();

        }

        private void workerMethod2(object sender, TarjeteroSharp.WaitWindowEventArgs e)
        {
            this.showInfo2(myDataGlobal);
        }

        private void showInfo2(DataSet myData)
        {

            /*PREPARANDO LA DATA ANTES DE ASIGNARLA:*/
            myData.Tables[0].TableName = "tarjeta1";
            rpt1.SetDataSource(myData.Tables["tarjeta1"]);
        }



您可以看一下我有一个"tarjeta1"是一个data_set此数据中的列
set是datagridview中的同一列

请告诉我 rpt对象(水晶对象)是否具有属性和特征
格式化单元格以允许时间数据.因为就我而言,该数据未显示在报告中.

在此先感谢.



You can look I have a "tarjeta1" is a data_set the columns in this data
set is the same column in the datagridview

Please tell me if a rpt object (crystal object) have a properties and features
that formatting the cells to allow time data. because in my case this data dont appear in the report.

Thanks in advance.

推荐答案


sqlqwery="select vuelta,linea.linea,salida,vsalida as ver,R1,M1,AT1,AD1,R2,M2,AT2,AD2,R3,M3,AT3,AD3,R4,M4,AT4,AD4,R5,M5,AT5,AD5 from deta_tarjeta,linea where deta_tarjeta.cod_tar=''"+tarjeta.cod+"'' and deta_tarjeta.cod_lin=linea.cod order by vuelta asc";



conexion con = new conexion();
            detaDs = con.consulta(sqlqwery);

            this.dataGridView2.DataSource = detaDs.Tables["dt"];
            dataReport = new DataSet();
            dataReport = detaDs;


myData=dataReport;
tarjetero1 rpt1 = new tarjetero1();
myData.Tables[0].TableName = "tarjeta1";
rpt1.SetDataSource(myData.Tables["tarjeta1"]);
this.crystalReportViewer1.ReportSource = rpt1;
this.crystalReportViewer1.Refresh();
myData.Dispose();





sql查询中的名称必须与图片中显示的xsd对象相同,然后有一个良好的映射,数据就会出现在报告中.

感谢您的关注.

问候,

Leo





the names in the sql query must be same than the xsd object showing in the picture, then there are a good mapping and the data is appear in the report.

thanks for your atention.

Regards,

Leo



这篇关于不在水晶报表中显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 03:26
查看更多