|
I dont know if it will work with vb.net but u can tweak the SQL that u use and format the date
eg
Dim strSQL As String = "SELECT f1, f2, f3, format(f4,'Short Date') FROM TableName ORDER BY f4 DESC;"
|
|
Expert:
|
nidhi
|
|
Date:
|
Apr 25, 2007
|
|
Time:
|
04:15
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
|
yes it should work, I tried it in C#
|
|
Expert:
|
nidhi
|
|
Date:
|
Apr 25, 2007
|
|
Time:
|
04:32
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
|
I used OleDbCommand and OleDbDataReader to read it and treat the datefield as a string
i.e.
OleDbCommand oleCmd = new OleDbCommand("SELECT format(mydtefld,'short date') FROM tblDates", oleConn);
and gettting that value worked like this
Console.WriteLine(oleRead.GetString(0).ToString());
so yes, u should be able to use the format command. It does mean u have to specify each column in your query though
|
|
Expert:
|
nidhi
|
|
Date:
|
Apr 25, 2007
|
|
Time:
|
04:32
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
|
One note: oleRead.GetString(0) returns a string, so why do you add a .ToString() to it?
Cheers
Peter
|
|
Expert:
|
PeterNZ
|
|
Date:
|
Apr 26, 2007
|
|
Time:
|
15:25
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
|
Thanks!
|
|
Expert:
|
aristud
|
|
Date:
|
Apr 26, 2007
|
|
Time:
|
17:45
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
|
|
|
|
|
This question has been answered, and points have been rewarded to the following experts:
You're welcome however to comment or give additional information or if you wish, you have the ability to write an Answer Summary for this question by clicking on the "Answer Summaries" Tab.
|
|