hi,
my problem is i want to display date using combo box. user will select da date and it will be save to db. da date will be separate to day, month and year. the main prob is i don't know how to aviod this happen 31/2/2005, don't no how 2 xplain....

anyone can help me?

Recommended Answers

All 10 Replies

Just setup an input mask or set the field type to a DATE field.

If you mean three sep boxes then thats even easier just say:

Day number must be greater then 0 but less then or = 31 but account for months with 30 days and 28 days etc.

Month > 0 <= 12

Year >= 2005 ??


Not sure what your trying to do exactly.. but its easy to link this up..

You could evn use the CALENDAR option.. popup a calendar let them select a date and populate fields..

or you can fgo the route of... CHOOSE A MONTH

Base don month you get days.... then CHOOSE a Year...

etc etc

that was gd idea, by pop up the calendar. but how can i link it to a textbox to display the date select by the user? should i use datepicker ? xtually wat is da fn of datepicker? thanks 4 your concern.

Use a calendar for this problem

the dtpicker seems to work best for most of my applications.

the dtpicker seems to work best for most of my applications.

I'll second that.

Can some one help me with the following. Any help will be appriciated.

Platfprm : Visual Studio 2005, Visual Basic

Situation : I have datepicker created in JAVA and call in Visual Basic .net program.

User Pick date and populate to text box.

And click save to SQL 2005 database as date fileld.

My problem is that how to convert date picker date(which is in text box) and save to database

Pls. give me code sample.

NK


My problem is that how to convert date picker date(which is in text box) and save to database

use Convert.DateTime(Textbox1.text)

or

CDate(Textbox1.text)

Can some one help me with the following. Any help will be appriciated.

Platfprm : Visual Studio 2005, Visual Basic

...........
..................
........................

NK

Please do not hijack others threads .
Start a thread of your own instead for fresh discussions.

procLicense = New SqlDataAdapter("procUpdateLicense", oConnection)
procLicense.SelectCommand.CommandType = CommandType.StoredProcedure

If num <> "" Then

procLicense.SelectCommand.Parameters.Add(New SqlParameter("@Date", SqlDbType.DateTime))

If LicenseDate.Text = "" Then
procLicense.SelectCommand.Parameters("@Date").Value = DBNull.Value
Else
procLicense.SelectCommand.Parameters("@Date").Value = CDate(LicenseDate.Text)
End If

Else
procLicense = New SqlDataAdapter("procInsertLicense", oConnection)
procLicense.SelectCommand.CommandType = CommandType.StoredProcedure
procLicense.SelectCommand.Parameters.Add(New SqlParameter("@Date", SqlDbType.DateTime))
If LicenseDate.Text = "" Then
procLicense.SelectCommand.Parameters("@Date").Value = DBNull.Value
Else
procLicense.SelectCommand.Parameters("@Date").Value = CDate(LicenseDate.Text) ' add cdate()
End If

End If


The code did not save date to database picking from datepicker(Fromat - 25 March 2008)

use Convert.DateTime(Textbox1.text)

or

CDate(Textbox1.text)

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.