How do I insert sysdate into a column

  • Thread starter Thread starter Phil Hunt
  • Start date Start date
P

Phil Hunt

I am using OLEDataAdaptor, DataTable and DataRow to insert a row like

dr["CREATEDDATE"] = ......

My question is how do I set that column to "Oracle sysdate"

TIA.
 
I know how to do it in a straight SQL statement. But not with thess fancy
object. Can you be more specific ???

Miha Markic said:
You have to properly compose (proper SQL syntax) InsertCommand or
UpdateCommand.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Phil Hunt said:
I am using OLEDataAdaptor, DataTable and DataRow to insert a row like

dr["CREATEDDATE"] = ......

My question is how do I set that column to "Oracle sysdate"

TIA.
 
Phil,

The Oracle System date is only on the server an can therefore only be done
in the SQL script itself.

The dr["Sysdate"] which is at the client side never reaches the Oracle
system, that what reaches the Oracle system is a parameter in the insert SQL
procedure or SQL procedure.

You can of course first select it, however then that datetime is again old.

Cor

Phil Hunt said:
I know how to do it in a straight SQL statement. But not with thess fancy
object. Can you be more specific ???

Miha Markic said:
You have to properly compose (proper SQL syntax) InsertCommand or
UpdateCommand.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Phil Hunt said:
I am using OLEDataAdaptor, DataTable and DataRow to insert a row like

dr["CREATEDDATE"] = ......

My question is how do I set that column to "Oracle sysdate"

TIA.
 
If you look at dataadapter it has three commands:InsertCommand,
UpdateCommand and DeleteCommand.
Each is executed for specific action (based on DataRow.RowState property).
These are all instances of DbCommand descendent classes.
You should look at its CommandText property where SQL command text is
stored.
By default all values are (more or less all) fetched from DataRow.
You should change this SQL text to your wishes (substitue a parameter with
sysdate - so value isn't fetched from datarow but rather it is done by using
sysdate on the server)

HTH
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Phil Hunt said:
I know how to do it in a straight SQL statement. But not with thess fancy
object. Can you be more specific ???

Miha Markic said:
You have to properly compose (proper SQL syntax) InsertCommand or
UpdateCommand.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Phil Hunt said:
I am using OLEDataAdaptor, DataTable and DataRow to insert a row like

dr["CREATEDDATE"] = ......

My question is how do I set that column to "Oracle sysdate"

TIA.
 
Back
Top