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
How to returns a value from stored procedure in ASP.NET
Oct 3 2006 3:13 PM
Hello! I have been trying to find an answer to my dillema for some time now, I hope that I can find an answer here. My dillema is that I am trying to return a value from a stored procedure. The prcedure is a simple count of records entered "today". This will then populate a variable in the Page_load of an ASP page. I then check the variable to see if there are any records, if there are then query the database to get the records. Some of the code I am using. This is the Class that has the connectionstring and parameters for the SP. 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 can not implicitly convert int to string } This is the calling code. int howManyCalls = GetDailyCallCount(out howManyCalls); Help please.
Reply
Answers (
0
)
UserControl with TextBox
How to update a record of a txt file in C# ?