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
Imran Bashir
NA
186
13.7k
Return Value from Stored Procedure To asp .net
Jul 31 2016 2:34 AM
i have this store procedure and i want to make this that will return the value to asp .net application when it is true or false...when the Store procedure return true then in asp lblresult.text=" true"; if the then that return false then lblResult=" falase";
============================================
ALTER
proc [dbo].[sp_Stock_check]
@
sum
int
,
@product_id
int
as
begin
SELECT
product_id
,
COUNT
(stock_in)
as
Count_stockIn
,
COUNT
(stock_out)
as
Count_stockOut
,
SUM
(stock_in)
as
Sum_stockIn
,
SUM
(stock_out)+ @
sum
AS
Sum_StockOut,
CASE
WHEN
SUM
(stock_in) >= (
SUM
(stock_out)+@
Sum
)
THEN
'true'
ELSE
'false'
END
AS
IsInGreater
From
Stock
Group
By
product_id
having
product_id = @product_id
end
============== Here is the asp .net code ========================
db.con.Open();
db.com =
new
SqlCommand(
"sp_Stock_check"
, db.con);
db.com.CommandType = CommandType.StoredProcedure;
db.com.Parameters.AddWithValue(
"@product_id"
,ddlProduct.SelectedValue);
db.com.Parameters.AddWithValue(
"@sum"
, txtQuantity.Text);
try
{
res = db.com.ExecuteNonQuery();
lblResult2.Text =
"Successfully data enter"
;
}
catch
(Exception ex)
{
lblResult.Text = ex.Message;
}
finally
{
db.con.Close();
}
Reply
Answers (
2
)
Dictionary out of range
how to delete file from folder on the server