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
Carlos Sanchez
NA
264
0
Insert DateTime in a field
Jul 13 2004 12:07 PM
I have the next code: SqlCommand command = new SqlCommand(); command.CommandText = "INSERT INTO Custumers (Num, Name, Address,City, State, BirthdayDate) VALUES (" + txtNum.Text + "," + txtName.Text + "," + txtAddress.Text + "," + txtCity.Text + "," + txtState.Text + "," + dtpBirthdatDate.Value.Date + ")"; command.ExecuteNonQuery(); dtpBirthdayDate is a DateTimePicker Component. When the command is executed the next error is ocurred: Line 1: Incorrect syntax near '12'. Any TextBox have the "12" string n' the dtpBirthdayDate (DateTimePicker) have {7/13/2004}. But when I start the application step by step, I can see that the dtpBirthdayDate value is 07/13/2004 12:00:00 a.m. may be this is the problem, but what can I do? can sombody help me?
Reply
Answers (
5
)
how to transfer data from excel to sql server table
Ms Access Syntax Error in Update Statement