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
dhoni kholi
NA
198
43.1k
How to get value from sql server
Feb 25 2020 4:43 AM
string
Bill;
protected
void
Page_Load(
object
sender, EventArgs e)
{
Bill =
"22-01-2020 "
;
if
(!IsPostBack)
{
cash();
}
}
protected
void
cash()
{
string
query =
"
select SUM((CASE WHEN ISNUMERIC([Total])=1 THEN CONVERT(MONEY,[Total]) ELSE 0 END))AS [Amount] from Bill where Bdate = CONVERT(DATETIME, '"
+ Bill +
"', 105) and Btype ='Cash'"
;
con.Open();
cmd =
new
SqlCommand(query, con);
SqlDataReader dr;
dr = cmd.ExecuteReader();
if
(dr.Read())
{
string
amount = dr[
"Amount"
].ToString();
lblCash.Text = amount.ToString();
con.Close();
}
con.Close();
}
This query value is Null,
How to i get Sum value from sql
Thanks all
Reply
Answers (
5
)
Offline Map in .net core mvc
Procedure expects parameter which was not supplied