how can i can save date in database from dtpicker..
and what is the way to assign date field of database to dtpicker.

Try the following -

Text1.Text = dtPicker1.Value

rsAddNew.AddNew
rsAddNew!Date = Text1.Text
rsAddNew.Update

To show the date value -

Text1.Text = rsAddNew!Date

i used dt picker, y i should use text box, i have used dtpickr for date.

also to asign database field to dtpicker DTPicker1 = rs.Fields("birthday")

I know you have used the dtPicker to select a date. You must still do something with the returned value though. I have found that by calling the value when using a database tends to screw up from time to time, hence the text box value. You can also add the value to a variable -

Dim xDate As Date 'At the top of your code form

'Under your dtPicker_Click event
xDate = dtPicker.Value.
'Now use the code above to add the date to your table.

Have a look at your "ADODC" post, I gave a full on tutorial there.

thanks....can u plz tell me, when i press Add New Button, all fields will b clear, but i want to Dtpicker show the system date...how it will b?

Its a pleasure.:)

By using the code I gave you above.

Daclare a variable for the date at the TOP of your form -

Option Explicit

Dim xDate As Date

Private sub Command1_Click()
'All text boxes has been cleared...
xDate = dtPicker1.Value
'This will hold the variable until you clear it.

'After adding new record, use...
xDate = vbnullstring

i said that when a button is pressed, the dtpicker should show system date, which date is stored in my computer, dtpicker should show that one, then it should b user's choice,which one he is selecting..

dtPicker1.Value = Now

It was a pleasure. Happy coding Jaseem.:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.