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
Albert
NA
42
4.3k
How to make string which contains datagridviews value
Jan 12 2015 9:19 AM
Here Is my Code to check available data in table if there exist any one value of Gridviews Column it will return the available value.
But there is somthing wrong so why it check only one value which is first in gridview.
The Code is as below
ok Here is the Full Code...
private void SureToDeleteBill() // Cheking For There Is No Imei in Bill Which Is Sold
{
try
{
for (int i = 0; i <= dataGridView2.Rows.Count-1; i++)
{
// check either imei is sold or available in Imei Sold table
cs.Open();
cmd = new OleDbCommand("select * from tblsIMEI where IMEI = @a0", cs);
cmd.Parameters.AddWithValue("@a0", dataGridView2.Rows[i].Cells[1].Value.ToString());
dr = cmd.ExecuteReader();
if (dr.Read())
{
string msg;
msg = dr["IMEI"].ToString();
MessageBox.Show("Sorry !!\nYou Can Not DeleteBill !\n Sold IMEI : ", "Sold IMEI", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
return;
}
else
{
DialogResult r = MessageBox.Show("Sure To Proceed?", "Delete Data", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (r == DialogResult.Yes)
{
DeleteFromtblPurchase();
DeleteFromtblIMEI();
DeleteFromPurchaseModel();
DeleteFromDealerBill();
MessageBox.Show("Record Delete Success!!", "Delete");
this.Close();
}
else
{
return;
}
}
cs.Close();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Sure To Delete");
}
finally
{
cs.Close();
}
}
Please help to solve it.
Reply
Answers (
0
)
How to use both "like" and "=" in select statment.
question aboat reportin by asp.net