Hi,
I'm using a DateTimePicker so a user can pick a date and then data can be retrieved from a database based on this date (by concatenating strings from the day, month and year parts of the date because the dtp.value.date returns a time reference on the end). However, the database stores the date with preceding zeros (eg 23/04/2011) but when I query the database, the query string shows the month represented as 4 rather than 04, and the DataReader can't find any matches because of this.
Though I'm not sure how this will make much difference, as I am using a separate string so that when the day or month are only 1 digit, a 0 is attached to the front. The command string still uses the 1 significant digit.
How can this be fixed/Am I doing something wrong?
Thanks in advance,
-TechniMan
I'm using a DateTimePicker so a user can pick a date and then data can be retrieved from a database based on this date (by concatenating strings from the day, month and year parts of the date because the dtp.value.date returns a time reference on the end). However, the database stores the date with preceding zeros (eg 23/04/2011) but when I query the database, the query string shows the month represented as 4 rather than 04, and the DataReader can't find any matches because of this.
Though I'm not sure how this will make much difference, as I am using a separate string so that when the day or month are only 1 digit, a 0 is attached to the front. The command string still uses the 1 significant digit.
How can this be fixed/Am I doing something wrong?
Thanks in advance,
-TechniMan
Last edited: