Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Date / Time conversion to string

$
0
0
Please pardon me for wasting your time on a primitive question like this.
But it has been giving me nightmares as I cannot figure it out why is it happening despite browsing net for the solution.
The code is:

 Dim SQL1,DATEST1, DATE_FINISH1, CODE1, MH1 As String

        DATEST1 = Me.DateTimePicker1.Value.ToString("d")
        DATE_FINISH1 = Me.DateTimePicker2.Value.ToString("d")

SOME OTHER NON RELEVANT CODE HERE

 SQL1 = "INSERT INTO LE_TIMELINE (PROJ_ID,DEPT_ID,DOC_ID,MH,START_DATE,FINISH_DATE) VALUES " & _
            "(" + PROJ_ID1 + "," + ThisUser.DeptID + "," + DOC_ID1 + "," + MH1 + ",'" & DATEST1 + "','" & DATE_FINISH1 + "')"




The error I get is:
"Unhandled exception....
Conversion failed when converting date and/or time from character string."

On one m/c on which VB.NET is installed, I face no problems but on other machines I am having this problem.

Request guidance please...

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>