Click here to Skip to main content
15,911,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have problem to make the procedure to return three value the problem appear when running crystal report returning empty values.

*proceduer running
SQL
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
C#
            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#">
Posted
Comments
Andy Lanng 30-Mar-15 5:38am    
does the procedure return values when run in sql?
Member 11538085 31-Mar-15 5:39am    
when running in sql give message
Command(s) completed successfully.
Member 11538085 31-Mar-15 5:41am    
can any body help me

1 solution

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.
 
Share this answer
 
Comments
Member 11538085 31-Mar-15 11:21am    
thank you for your reply .
please more explain what you say
best regards
deepankarbhatnagar 1-Apr-15 0:32am    
I am not understanding why my answer marks as downvoted.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900