Question My Procedure in sql have record but for Datasource of DataGridview not shown...

hahaie

New member
Joined
Feb 3, 2016
Messages
4
Programming Experience
1-3
hi all,
I have a Procedure:
C#:
ALTER Procedure [dbo].[Teeeest] As
Declare    @Cols    varchar(max),
           @Sql     varchar(max)
Set @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,'                        
                     + @Cols 
                 + 'From   Tb_Section Where Sec_Base = 0 Order by Sec_Name'                            
exec (@Sql)

Value Of @Col is :
''AS [Sec5],''AS [Sec7],''AS [Sec8],''AS [Sec9],''AS [Sec11]
and output is:
11111.jpg

I want exactly this output in C#.So I set on Datasource of Datagridview but My grid no any record.
why?
please help me
 
please help me

Did you read my post? I can't help you because you haven't provided any information for us to work with. This is a C# forum and all you've given us is SQL code that works. If the C# doesn't work then it might help if we saw the relevant C# code, no?
 
Excuse me,Yes I already read your post.
This is a point an it is users of Sql forum say my post related to C# forum(of cource,in others sites) and you say my post related to Sql forum !!
Reason of users of Sql forum for this say,When my procedure have output but it not output in C#,So it is a problem in C#!
 
So it is a problem in C#!
I'm not disputing that it is an issue with the C# application. I already acknowledged that the SQL works. I'm saying is that we can't magic you a solution to your C# problem if we don't know anything about your C# project. We can't read your mind.
 
Back
Top Bottom