24 minutes ago,itsnotabug wrote
this is proving easier than i thought! the only thing i'm having trouble with is using parameters. the sqlcommand had a method for paramters I could use like:
but the dbcommand doesn't have it.. i only see
cmd.Parameters.Add(Key)... how does the command know which parameter the value is associated with? some of my queries have dozens of parameters.
internet high-five to anyone with an answer!
You have to use a bit of sugary syntax. I don't know why the ADO.NET guys designed it like that, I guess they were trying to be "hip".
Anyway, if you look at the .Add() method, you'll see it actually returns an IDbParameter object, so you do this:
cmd.Parameters.Add(key).Value = myValue;
Silly, I know, but they made that design choice over 10 years ago, now we have to live with it.
...or better yet: why not define an extension method? (I heard they removed the Oracle client library in .NET4).