17
Reply

when using Stored Procedure called from C# ?

Dong Lam Trien

Dong Lam Trien

Jun 20 2014 3:53 AM
1.3k
In SQL Server 2005 Stored Procedure I have the following: 

Code:
CREATE FUNCTION [dbo].[LISTSTAFF]()
RETURNS TABLE
AS    
RETURN(select * from tblStaff);

In C#2005 I assign staff style table for gridview an error, can you help me fix this ?

Code:
...
SqlCommand cmd = new SqlCommand("LISTSTAFF", cnn);
cmd.CommandType = CommandType.StoredProcedure;
gridview.DataSource = cmd.ExecuteReader();// waring error in here
...
I want assign list database style table for gridview.DataSource =... how assign ?

Answers (17)