954,582 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

date problem

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?

LadyFinger
Newbie Poster
4 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

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

techniner
Posting Pro
527 posts since May 2005
Reputation Points: 12
Solved Threads: 19
 

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.

LadyFinger
Newbie Poster
4 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 
techniner
Posting Pro
527 posts since May 2005
Reputation Points: 12
Solved Threads: 19
 

Use a calendar for this problem

roof
Newbie Poster
1 post since Sep 2005
Reputation Points: 10
Solved Threads: 0
 

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

jwshepherd
Junior Poster
123 posts since Jun 2005
Reputation Points: 20
Solved Threads: 5
 
the dtpicker seems to work best for most of my applications.

I'll second that.

mnemtsas
Posting Whiz in Training
200 posts since Jul 2004
Reputation Points: 16
Solved Threads: 1
 

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

nasir1149
Newbie Poster
3 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 
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)

choudhuryshouvi
Posting Pro
553 posts since May 2007
Reputation Points: 30
Solved Threads: 49
 

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.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

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)

nasir1149
Newbie Poster
3 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You