TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jagannatha Thripp
NA
8
0
Stored procedure return value
Oct 2 2006 10:34 PM
Hello all, I am trying to understand C# in VS 2005 sepcifically ASP web pages, I have managed to write some simple stored procedures to our SQL 200 server, that populate datatables fine. But when it comes to writing a stored procedure to return a value, well boy is this giving me a headache!!!! History:- Stored procedure ALTER PROCEDURE dbo.CountCalls ( @HowManyCallsToday int output ) AS SELECT @HowManyCallsToday = Count(*) FROM HD_Call WHERE (CONVERT(Varchar(10), DateRaised, 101) = CONVERT(varchar(10), GETDATE(), 101)) AND Status In ('Assigned', 'In Progress', 'Logged', 'On Hold', 'ReadyToGoLive'); RETURN When I try to get the value of @HowManyCallsToday back into the C# code I am gettin alsorts of wierd and wonderful things happening. C # code: This is a class being called form the ASP page in Page_load. Calling code: int howManyCalls; // How many logged errors? howManyCalls = CatalogAccess.GetDailyCallCount(out howManyCalls); Called class: public static string GetDailyCallCount(out int howManyCalls) { DbCommand comm = GenericDataAccess.CreateCommand(); comm.CommandText = "CountCalls"; DbParameter param = comm.CreateParameter(); param.ParameterName = "@HowManyCallsToday"; param.Direction = ParameterDirection.InputOutput; param.DbType = DbType.Int16; comm.Parameters.Add(param); //DataTable table = GenericDataAccess.ExecuteSelectCommand(comm); comm.Parameters["@HowManyCallsToday"].Direction = ParameterDirection.Output; int HowManyCallsToday; GenericDataAccess.ExecuteSelectCommand(comm); HowManyCallsToday = Int32.Parse(comm.Parameters["@HowManyCallsToday"].Value.ToString()); return HowManyCallsToday; // Error cannot implicitly convert int to string } Any help offered will be grately appreciated.
Reply
Answers (
0
)
Saving a Blob file into SQL Server with Visual Studio .Net 2005
Suite Integration Toolkit Error