-
June 20th, 2014, 03:15 AM
#1
when using Stored Procedure called from C# ?
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 ?
-
June 21st, 2014, 01:43 PM
#2
Re: when using Stored Procedure called from C# ?
Try to EXECUTE the query, and THEN assign it.
-
June 21st, 2014, 07:13 PM
#3
Re: when using Stored Procedure called from C# ?
I try to run the EXEC good as when brought into the program will not run
-
June 22nd, 2014, 01:45 AM
#4
Re: when using Stored Procedure called from C# ?
The QUERY doesn't run? That means it's wrong
-
June 22nd, 2014, 11:41 PM
#5
Re: when using Stored Procedure called from C# ?
it don't run in program C# but I did it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|