parameters - Finding out SQLParameters of a SQLCommand -
at point in past, in vb6 days, remember being able create sql command object (not same 1 today's .net flavour), , have sql parameters automatically filled in.
this allowed me do things passing in parameters knew exist, , if 2 different clients using different versions of database, call procedures knowing still meaningful response.
something this:
dim cmd sqlcommand set cmd = new sqlcommand(connection) cmd.commandtext = "magicstoredprocedure" cmd.commandtype = commandtype.storedprocedure if cmd.parameters.count > 0 if cmd.parameters(0).name = "@firstparameter" cmd.parameters("@firstparameter").value = somevalue end if end if dim r recordset set r = cmd.executerecordset()
i remember doing this, cannot find examples of own, , trying in .net not seem work @ all. examples have seen (and have searched time) add parameters manually.
any pointers?
i have found sqlcommandbuilder.deriveparameters procedure, wanted.
sqlcommandbuilder.deriveparameters(cmd) if cmd.parameters.contains("@firstparameter") cmd.parameters("@firstparameter").value = somevalue end if
not expected it, though. i'd expect baked in command object, or in parameters collection.
Comments
Post a Comment