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
Stylus STYLUS
NA
17
1.3k
Quantity increment dont work with leterQuantity +1 dont work
Feb 21 2019 1:33 PM
Some help
In line 10 setup
IsLetterOrDigit..
When add some value in datagrid
Line 34-39 have problem...
Every time add new row, if put number it ok kolicina (quantity go up +1), if is bar code type vm1403 add new row...not kolicina (quantity) +1...why? Some help?
int
cqty = Convert.ToInt32(row.Cells[
"kolicina"
].Value) + 1;
if
(textBox1.Text == row.Cells[
"bar_kod"
].Value.ToString())
{
row.Cells[
"kolicina"
].Value = cqty;
private
void
prijavaAction()
{
PullData();
int
sno = dataGridView1.Rows.Count + 1;
SqlConnection con2 =
new
SqlConnection(con);
if
(textBox1.Text.All(
char
.IsLetterOrDigit))
{
string queryString =
"select [bar_kod], [naziv], [cijena_sa_porezom] from dbo.roba_usluge WHERE [bar_kod] = '"
+ textBox1.Text +
"'"
;
// pronaci artikl u bazi
using
(SqlConnection connection =
new
SqlConnection(con))
{
SqlCommand command =
new
SqlCommand(queryString, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
/////////////////////////////////
errorr var itemAndPrice = textBox1.Text;
var SingleRow = (from Rows in dataGridView1.Rows.Cast
() where !Rows.IsNewRow && Rows.Cells[
"bar_kod"
].Value.ToString().ToUpper() == textBox1.Text.ToUpper() select Rows).FirstOrDefault();
if
(reader.Read())
{
bool
barcodeexist =
false
;
foreach (DataGridViewRow row in dataGridView1.Rows)
{
int
cqty = Convert.ToInt32(row.Cells[
"kolicina"
].Value) + 1;
if
(textBox1.Text == row.Cells[
"bar_kod"
].Value.ToString())
{
row.Cells[
"kolicina"
].Value = cqty;
////////////////////////////////
foreach (DataGridViewRow g1 in dataGridView1.Rows)
{
g1.Cells[
"ukupno"
].Value = (Convert.ToDouble(g1.Cells[
"kolicina"
].Value) * Convert.ToDouble(g1.Cells[
"cijena"
].Value)).ToString(
"0.00"
);
}
Reply
Answers (
0
)
Bind GridView in Rows
mvc web forms data flow to database