Use a DateTime Picker to update records in a Sql database

fadiel ras
fadiel ras used Ask the Experts™
Hi there. I don't yet have any code for this and am hoping that there is an off-the-shelve piece of code I can use to update records to a Sql database, using a DateTime Picker.
If anyone recently used this control, please share.
if this is the incorrect forum for this kind of help, just let me know, as I can then remove the question.

The question is- I'm looking for a sample of how to commit records to a SQL database using values selected via a DateTime Picker control in

I basically just need to see how it works, then I'll continue on my own
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014
What you're asking doesn't make a lot of sense. A DateTime Picker is just a control - it shows a value and allows the user to choose a value.

If you want to update records in a database, you can do it several ways. You can use the SQLCommand method, for instance:

Imports System.Data.SQLClient

Using con As New SQLConnection("Your connection string")
  Using cmd As New SQLCommand
    cmd.Connection = con
    cmd.CommandText = "INSERT INTO SomeTable(SomeField) VALUES('" & YourDateTimePicker.Value & "')"
  End Using
End Using

If you're using bound controls then you have builtin methods for doing this. There are quite a lot of tutorials on this on the MSDN website. Here's one:


thanks. I'm not using bound controls.
I think this is the piece of code I couldn't really find in my research:
cmd.CommandText = "INSERT INTO SomeTable(SomeField) VALUES('" & YourDateTimePicker.Value & "')".

the answer will suffice to get me started, thanks. I'll accept the answer accordingly.


Thanks Scott!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial