default values

S

Stanislaw Tristan

It's MS Access database. Some table has a fields with default values, for
example, =Date().
But when I adding a row in DataGrid - the default values not displayed. If I
not fill this fields and then update dataset - in database all records added
via DataGrid - without default values.
How can I resolve this problem and default values displays in DataGrid?

Thanks.
 
S

Stanislaw Tristan

Thanks, but I need another thing.
Ok, I rebuild my question:
1. I have a some database (MS Access, MySQL, PostgreSQL - it's no matter)
2. In this database I created a table with, for example, 2 columns:
- custName varchar(50) not null
- custDate date DEFAULT current_date()
So, the default values are programmed inside database.
Next I created a WinForms project, added a OleDbDataAdapter that linked to
this table, created dataset, placed DataGrid and set it's datasource
property to the dataset. In Load event of the form I filled the dataset, but
the default values is not visible in the new row.
Question: how AUTOMATICALLY retrieve the default values and show them to the
end user?
 
C

Cor Ligthert

Hi Stanislaw,

I assume you mean something as this
Untested
ds.Tables(0).Columns("custDate").DefaultValue = Now

I hope this helps?

Cor
 
S

Stanislaw Tristan

NO, I want that the dataset retrieve and INHERITS the default values from
DATABASE, where I programmed them before
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top