date problem

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2008
Posts: 3
Reputation: nasir1149 is an unknown quantity at this point 
Solved Threads: 0
nasir1149 nasir1149 is offline Offline
Newbie Poster

Re: date problem

 
0
  #11
Mar 31st, 2008
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)

Originally Posted by choudhuryshouvi View Post
use Convert.DateTime(Textbox1.text)

or

CDate(Textbox1.text)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC