How to populate date field with current date in C# or Vb.net

456
1
10-25-2019 06:22 AM
JoseSanchez
Occasional Contributor III

Hello everyone,

Is this correct ?

pRow.set_Value(pRow.Fields.FindField("DATECREATED"), Today)
pRow.Store()

0 Kudos
1 Reply
TedKowal
Occasional Contributor III

I do something like this 

'Populate the stats table with the iteration.
    Dim row As IRow = tTable.CreateRow
    Dim fields As IFields = row.Fields

    Dim fDate As Date = fields.FindField("DateCreated")
    row.Value(fDate) = Today
    row.Store()

 )‍‍‍‍‍‍‍‍‍‍‍

Another method would be creating an Update SQL Query and executing that assuming that your data is in a real database and not a file geodatabase.

0 Kudos