Groups > Databases > Access Databases and AccessDataSource Control > Re: Is it possible to display the "date" in a column that isn't necessarily in the database?




Is it possible to display the "date" in a column
that isn't necessarily in the database?

Is it possible to display the "date" in a column that isn't necessarily in the database?
Wed, 2 Apr 2008 15:18:28 +0000
Is it possible to display the "date" in a column that isn't
necessarily in the database? for example, my database has three fields: Name,
Email, and Comment. However, when I display it (using a datagrid), I want to
display each record with the date it was entered. Is that possible?
Post Reply
Re: Is it possible to display the "date" in a column that isn't necessarily in the database?
Wed, 2 Apr 2008 16:23:55 +0000
Where will that date value come from?

Anyway, you can add columns to you data table (which has the data from DB) and
value for that column for each row.

// File DataTable

DataTable.Columns.Add ("EnteredOn", typeof(DateTime));

// Set value for EnteredOn by looping thru DataTable.Rows
Post Reply
Re: Is it possible to display the "date" in a column that isn't necessarily in the database?
Wed, 2 Apr 2008 16:25:57 +0000
Doesn't that value have to come from some where? How do you decide what date to
display ??
Post Reply
Re: Is it possible to display the "date" in a column that isn't necessarily in the database?
Wed, 2 Apr 2008 17:39:08 +0000
Jeev and Siva...thanks for your feedback.

I actually just added the column in my database to capture the date. Now...my
NEW problem is that when I display my records, the date stamp always shows
"12:00AM" how do I fix that? PS. I am using Access database...
Post Reply
Re: Is it possible to display the "date" in a column that isn't necessarily in the database?
Wed, 2 Apr 2008 23:46:03 +0000
When entering a record, use the Access Now() function as the value to insert:

Insert into mytable (field1, field2, DateField) Values (value1, value2, Now())
Post Reply
about | contact