View Single Post
  #7 (permalink)  
Old March 31st, 2006, 05:00 AM
kshort kshort is offline
Registered User
 
Join Date: Mar 2006
Location: , , United Kingdom.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem I had was that when the code was run Visual Studio decided to change my INT OUTPUT parameter into a STRING INPUT.

I have no idea why it did that, as it was declared as <asp:Parameter Direction="Output" Name="ERR" Type="Int32" /> in the source, but when I got to the deleting/deleted events the e.command.parameters had it as a STRING INPUT. I'm still hoping someone has some suggestions for why that was happening.

The way I fixed it was to get hold of the parameter in the deleting(or inserting in your case) event for the datasource and set the parameter type & direction via code.

            SqlParameter outParam = (SqlParameter)e.Command.Parameters["@ERR"];
            outParam.SqlDbType = SqlDbType.Int;
            outParam.Direction = ParameterDirection.Output;
            e.Command.Parameters["@ERR"] = outParam;

Reply With Quote