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
Atul Rokade
NA
141
43.7k
how to insert current date into access database?
Jul 25 2016 12:53 PM
Actually im creating one application where i inserted user sales count, sales count is updating fine but when i edit in query by putting current date its not updating detail Here im putting whole code
Private void button1_Click_1(object sender, EventArgs e)
{
this.txtinput.MaxLength = 4;
cmd = new OleDbCommand("update Login set Sales_count= IIF(IsNull(Sales_count), 0, Sales_count) + 1 where [Unique_No]=@Unique_No and [To_Date]='#"+DateTime.Now.ToString("dd/MM/yyyy")+"#'", con);
cmd.Parameters.AddWithValue("@Unique_No", txtinput.Text);
con.Open();
int n = cmd.ExecuteNonQuery();
if (n == 0)
{
MessageBox.Show("Invalid Unique No. pls try again later");// **Debugger come to this line if i insert [To_Date]='#"+DateTime.Now.ToString("dd/MM/yyyy")+"#'** // if i remove above line in code then its updating fine
}
else
{
this.DialogResult = DialogResult.OK;
}
con.Close();
}
}
Reply
Answers (
5
)
SpeechSynthesizer & SpeechRecognizer
Reporting Panel Speed