晶体报告和c#代码的程序问题 [英] problem in procedure with crystal report and c# code

查看:79
本文介绍了晶体报告和c#代码的程序问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题让程序返回三个值,运行水晶报表返回空值时出现问题。



*程序员运行

i have problem to make the procedure to return three value the problem appear when running crystal report returning empty values.

*proceduer running

USE [smart_training]
GO
/****** Object:  StoredProcedure [dbo].[comming_num_zero]    Script Date: 03/30/2015 11:51:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER proc [dbo].[comming_num_zero]
@fld varchar(200),@val varchar(200),@ral varchar(200)  
as
DECLARE @sql nvarchar(max) =
'SELECT [area]
      ,[zone]
      ,[date]
      ,[course]
      ,[totalnum]
      ,[clocknum]
      ,[commingnum]
      ,[absent]
      ,[repeating]
      ,[supervisor_name]
      ,[course_price]
      ,[total_price]
     FROM [smart_training].[dbo].[account_head] inner join acountment on account_head.action =acountment.action where '+@fld + ' = '''+@val+''+@ral+''''
 exec sp_executesql @sql



运行水晶报告


running crystal report

            if (radioButton1.Checked && radioButton6.Checked)
            {
                commaing_zero2 myreport2 = new commaing_zero2();
                myreport2.SetParameterValue("@fld", "account_head.area");
                myreport2.SetParameterValue("@val",comboBox1.Text);
                myreport2.SetParameterValue("@ral", "and      acountment.totalnum=acountment.commingnum");
                Form6 myform = new Form6();
                myform.crystalReportViewer1.ReportSource = myreport2;
                myform.ShowDialog();
            }
<pre lang="c#">

推荐答案

nvarchar(max)只会给出一行最大值使用此值,您永远无法获得所需的3值,将其替换为前3并尝试使用。
Hi, nvarchar(max) will give only a single row which is max value , by using this you can never get the 3 value which use required, replace it with top 3 & try it.


这篇关于晶体报告和c#代码的程序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆