I receive from the DB a date (sql smalldatetime format) broken in three parts (day, month and year. Each one in a different parameter). And once in the web app I want to use day and month with the format (01, 02, 03,.., 10, 11,..), I mean with a leading 0 if necessary, since now I receive day and month with the format (1, 2, 3,.., 10, 11). How can I format the received data?
Here a piece of the sub that receives the data:
strConnection.open()
CmdRecover.ExecuteNonQuery
If Not CmdRecover.Parameters("@day").Value Is DbNull.Value Then
day.SelectedValue = CmdRecover.Parameters("@day").Value
End If
If Not CmdRecover.Parameters("@month").Value Is DbNull.Value Then
month.SelectedValue = CmdRecover.Parameters("@month").Value
End If
If Not CmdRecover.Parameters("@year").Value Is DbNull.Value Then
year.Text() = CmdRecover.Parameters("@year").Value
End If
Thank youThere is a function in VB that does this operation automatically!. So, the problem it' s solved.or you could use year.Text() = CmdRecover.Parameters("@year").Value.ToString("0000") which will turn 02 to 0200
but you get the idea.
Here a piece of the sub that receives the data:
strConnection.open()
CmdRecover.ExecuteNonQuery
If Not CmdRecover.Parameters("@day").Value Is DbNull.Value Then
day.SelectedValue = CmdRecover.Parameters("@day").Value
End If
If Not CmdRecover.Parameters("@month").Value Is DbNull.Value Then
month.SelectedValue = CmdRecover.Parameters("@month").Value
End If
If Not CmdRecover.Parameters("@year").Value Is DbNull.Value Then
year.Text() = CmdRecover.Parameters("@year").Value
End If
Thank youThere is a function in VB that does this operation automatically!. So, the problem it' s solved.or you could use year.Text() = CmdRecover.Parameters("@year").Value.ToString("0000") which will turn 02 to 0200
but you get the idea.