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
Goran Bibic
457
2.9k
195.3k
What is wrong?
Jan 25 2018 3:53 AM
private
void
button4_Click(object sender, EventArgs e)
{
if
(bar_code1DataGridView.SelectedRows.Count > 0)
{
DataGridViewRow dr = bar_code1DataGridView.SelectedRows[0];
if
(!string.IsNullOrEmpty(dr.Cells[
"dataGridViewTextBoxColumn1"
].Value.ToString()))
{
String cs =
"Data Source=.\\SQLEXPRESS;Initial Catalog=barcode;Integrated Security=True"
;
using
(SqlConnection openCon =
new
SqlConnection(cs))
{
using
(SqlCommand querySaveStaff =
new
SqlCommand(
"DELETE FROM bar_code1 WHERE id=@id"
, openCon))
{
// querySaveStaff.Parameters.Add("@id",SqlDbType.Int).Value=idTextBox.Text;
querySaveStaff.Parameters.AddWithValue(
"@id"
, 0);
openCon.Open();
querySaveStaff.ExecuteNonQuery();
openCon.Close();
}
}
using
(SqlConnection openCon =
new
SqlConnection(cs))
{
string saveStaff =
"SELECT * FROM dbo.bar_code1 "
;
openCon.Open();
using
(SqlDataAdapter querySaveStaff =
new
SqlDataAdapter(saveStaff, cs))
{
querySaveStaff.Fill(barcodeDataSet.bar_code1);
bar_code1DataGridView.DataSource = barcodeDataSet.bar_code1;
bar_code1DataGridView.Update();
bar_code1DataGridView.Refresh();
}
}
}
}
}
Reply
Answers (
5
)
How To send Email to all Registered User E-mail ID in ASP C#
Open new window using ASP.Net without hitting popup blocker