17
Answers

when using Stored Procedure called from C# ?

Dong Lam Trien

Dong Lam Trien

10y
2.8k
1
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)