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
Hezekiah Oluwabukola
NA
43
5.2k
How to delete data by date range
Aug 16 2017 10:31 PM
Am having a problem in my c sharp application. I want to delete data inside database (am using MSSQL server 2012) between two selected date. But my propblem is, after I click on delete button messageBox shows deleted successfully but when I view the data inside database I still see them which means the data is not deleted. please I need someone to help me. this is my code so far.
string query = "DELETE FROM TABLE_SALES WHERE DATE >= '" + DateTimee.Value.Date.ToString() + "' AND DATE <= '" + DateTimee2.Value.Date.ToString() + "'";
dt = new DataTable();
sda = new SqlDataAdapter(query, con);
sda.Fill(dt);
dataGridView1.DataSource = dt;
con.Close();
MessageBox.Show("SALES DELETED SUCCESSFULLY", "MESSAGE", MessageBoxButtons.OK, MessageBoxIcon.Information);
Reply
Answers (
2
)
datagridview1 row count less 1
regex for to accept letters, special charecters,spaces only