- ALTER Procedure [dbo].[Prc_TBMonPerfSecNBase_BlnForm](@P_Year varchar(4),@P_Month varchar(2))
- As
- Declare @Cols varchar(max),
- @Sql varchar(max)
-
- Select @Cols=Stuff((Select ',''''AS ' + quotename(Sec_Name)+',''''AS '+quotename(Sec_Code)
- From Tb_Section
- Where Sec_Base = 1
- For xml path('')), 1, 1, '')
- Set @Sql = 'Select Sec_Name,
- Sec_Code,'
- +@P_Year+'[???]'+
- ','
- +@P_Month+'[???]'+
- ','
- + @Cols
- + 'From Tb_Section Where Sec_Base = 0 Order by Sec_Name'
-
- exec (@Sql)
this procedure has output in Sql.But When this procedure set Datagridview.DataSource,DataGridView not have any row.
please help me...