I want to convert a date value to string in vb.net, but its not working heres my code in vb.net when try to convert to string
While (sqlReader.Read())
....
pro.fechaOperacion = Convert.ToString(sqlReader.GetString(3))
end while
and this is my code for my stored proc
select ...
Convert (date, EN.FECHA,103),
...from Fact
Please I need your help.
You will run into unnecessary complications if you use strings for dates in your code. The only times you normally need to convert between the two are for input and output.
You can modify your code (as shown) to achieve that:
pro.fechaOperacion
a DateTime
instead of a String
.SELECT ... [date] ... FROM Fact
*.pro.fechaOperacion = sqlReader.GetDateTime(3)
.* Use the appropriate delimiters for your database if `[` and `]` are wrong.