BryanB
08-30-2007, 06:51 PM
I have a DAO that extends Spring.Data.Core.AdoDaoSupport. I have a Save(object) method wherein I do a AdoTemplate.Execute(delegate(IDbCommand)).
Within my delegate method I am attempting to build parameters for a SQL stored procedure using the IDbParametersBuilder. This is all working up to the point where I would like to add my newly created parameters to my IDbCommand. I have attempted to do:
IDbParameters prms = builder.GetParameters();
foreach (IDbDataParameter prm in prms.DataParameterCollection)
command.Parameters.Add(prm);
I get the following exception:
System.ArgumentException : The SqlParameter is already contained by another SqlParameterCollection.
I have also explored using the the AdoTemplate.ExecuteNonQuery(...)but i need to return a business object after the stored proc has been called.
Any suggestions?
Thanks in advance!
Bryan
Within my delegate method I am attempting to build parameters for a SQL stored procedure using the IDbParametersBuilder. This is all working up to the point where I would like to add my newly created parameters to my IDbCommand. I have attempted to do:
IDbParameters prms = builder.GetParameters();
foreach (IDbDataParameter prm in prms.DataParameterCollection)
command.Parameters.Add(prm);
I get the following exception:
System.ArgumentException : The SqlParameter is already contained by another SqlParameterCollection.
I have also explored using the the AdoTemplate.ExecuteNonQuery(...)but i need to return a business object after the stored proc has been called.
Any suggestions?
Thanks in advance!
Bryan