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
Manawoba michael
NA
10
2.9k
comparing gridview column values with sql table column value
Mar 19 2019 8:12 AM
i want to compare gridview column values with sql server table column values and if the values from the database is less than the gridview values the gridview row backcolor will change to black but when greater than gridview values backcolor will be red.
below is my c# code behind thanks in advance for your answers.
public
void
CheckStock()
{
int
DBQuantity =0;
foreach
(GridViewRow row
in
gvCartItems.Rows)
{
for
(
int
i = 0; i <= gvCartItems.Rows.Count; i++)
{
con =
new
ConnectionClass();
String pid = gvCartItems.Rows[i].Cells[1].Text;
string
gvQty = gvCartItems.Rows[i].Cells[4].Text;
dr = con.DataReader(
"SELECT Quantity FROM ProducesView WHERE ProduceId = '"
+ pid +
"'"
);
if
(dr.Read())
{
DBQuantity = dr.GetInt32(0);
dr.Close();
}
int
gridQty;
int
.TryParse(gvQty,
out
gridQty);
if
(DBQuantity > gridQty)
{
gvCartItems.Rows[i].BackColor = System.Drawing.Color.Black;
}
con.CloseConnection();
}
}
}
Attachment:
Screenshot_(25).zip
Reply
Answers (
1
)
I want to return the return the response body of POST
print crystal report