Date and Time Displayed Together in DataGrid
Hi,
I had posted this message on a different forum but found this one to be more appropriate
I Bind Data From a Database onto a Datagrid Control. One Of the Fields of a Table in that Database is A Date Value of type Short Date("mm/dd/yyyy"). All Values in that field are stored in the same format.
But when I Display the Date using the datagrid control , it gets displayed along with a Time Value
To make things clear here is a simplified version of
my code
dim qerr as string
dim cmd as oledbcommand
dim connection as oledbconnection
DIM myreader as oledbdatareader
connection = new oledbconnection("Provider= Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("db1.mdb"))
connection.open
querr = "SELECT Dateofjoin from UserData "
cmd = New OleDbCommand(querr,connection)
myreader = cmd.ExecuteQuery
Here db1.mdb is the Database
UserData is the Name of the Table
DateofJoin is the Field of that Table
The DateofJoin may contain a Value 7/16/2004.But when I display it in ASP.Net by binding it to a Datagrid Control, The Date Gets Displayed as 7/16/2004.12:00:00 A.M.
Note : I tried
querr = "SELECT Format(Dateofjoin,'dd-mm-yyyy') from UserData "
but it gave an error.
__________________
-.. -..
|