tags:

views:

44

answers:

1

I'm using an OracleCommandBuilder to autogenerate SQL based on a SELECT statement. The parameters in the generated UPDATE, INSERT, and DELETE statements take the form :p1, :p2, and so forth.

In the course of researching how to use the OracleCommandBuilder, I could swear that somewhere I ran across a property I could set, or something I could do to get the parameters to mirror the column names, so a LASTNAME column would have a :LASTNAME parameter generated.

But now I can't figure out how to do it. Has anyone heard of such a setting, or did I imagine it?

A: 

Oh geez, there it is.

GetInsertCommand(bool) (and similarly for GetUpdateCommand and GetDeleteCommand)

I didn't realize there were overloads of these.

Kyralessa
Strangely, though, it generates parameters named without the colon in front: "LASTNAME" instead of ":LASTNAME". Is that a problem? If not, what is the colon for?
Kyralessa
Ah, here we go: "When using named parameters in an SQL statement called by an OracleCommand of CommandType.Text, you must precede the parameter name with a colon (:). However, in a stored procedure, or when referring to a named parameter elsewhere in your code (for example, when adding OracleParameter objects to the Parameters property), do not precede the named parameter with a colon (:). The .NET Framework Data Provider for Oracle supplies the colon automatically."
Kyralessa