Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing function as parameter

Status
Not open for further replies.

schwankieog

Programmer
Jul 25, 2001
43
US
Hi,
I have a datetime variable i need to insert into an oracle database. since i have been unable to find a "standard" datetime string format for oracle, i am trying to pass the to_date() oracle function as the parameter. when i attempt this i receive the error that non-numeric text was found where numeric text was expected. any help either with a standard format or a way to pass this function would be grealty appreciated. here is the code in question:

insert.Prepare();

foreach (System.Data.DataRow row in archSet.Tables[table.TableName].Rows) {
foreach (System.Data.DataColumn col in cols)
((IDbDataParameter) insert.Parameters[col.ColumnName]).Value = //here is where i need the help;

insert.ExecuteNonQuery();
}
 
I would put the to_date() function in your SQL, and not pass it as a parameter. Parameters are for setting values, not writing dynamic SQL.

If you were to attempt to use a parameter to specify a column to bring back in your SELECT clause, you'd probably get the same, or a similar, error.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top