13
Answers

My Procedure not have output in C# for Datasoure GridView

a h

a h

8y
731
1
hi all,
I have a procedure:
  1. ALTER Procedure [dbo].[Prc_TBMonPerfSecNBase_BlnForm](@P_Year varchar(4),@P_Month varchar(2))  
  2. As  
  3. Declare    @Cols    varchar(max),  
  4.            @Sql     varchar(max)  
  5.   
  6. Select     @Cols=Stuff((Select ',''''AS ' + quotename(Sec_Name)+',''''AS '+quotename(Sec_Code)  
  7.                               From Tb_Section  
  8.                              Where    Sec_Base    = 1  
  9.                             For xml path('')), 1, 1, '')  
  10. Set    @Sql    = 'Select Sec_Name,  
  11.                             Sec_Code,'  
  12.                             +@P_Year+'[???]'+  
  13.                             ','  
  14.                             +@P_Month+'[???]'+  
  15.                             ','  
  16.                             + @Cols   
  17.                  + 'From   Tb_Section Where Sec_Base = 0 Order by Sec_Name'  
  18.   
  19. exec    (@Sql) 
 this procedure has output in Sql.But When this procedure set Datagridview.DataSource,DataGridView not have any row.
why?
please help me...
thanks
 

Answers (13)