I am not sure if its asp:SqlDataSource
control or it's the ASPxTreeList
from DevExpress I am using but I am getting a weird error when trying to fire a Stored Procedure using the Insert()
method.
When adding a node I try to insert the node into the database
protected void TagList_NodeInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
{
SqlDataTagging.InsertCommandType = SqlDataSourceCommandType.StoredProcedure;
SqlDataTagging.InsertParameters.Add("ParentID", e.NewValues["ParentTag_ID"].ToString());
SqlDataTagging.InsertParameters.Add("TagName", e.NewValues["TagName_VC"].ToString());
SqlDataTagging.InsertParameters.Add("UserID", "1");
SqlDataTagging.InsertCommand = "sp_InsertTag";
SqlDataTagging.Insert();
}
However when I fire the above code, I get this error
Procedure or function sp_InsertTag has too many arguments specified.
My SP header
ALTER PROCEDURE [dbo].[sp_InsertTag] (@ParentID INT, @TagName VARCHAR(100), @UserID int)
But as you can see, there are 3 parameters in the SP and 3 in the C# code.
Weirdly, if I actually run the SQL via text e.g.
SqlDataTagging.InsertCommandType = SqlDataSourceCommandType.Text;
and write the SQL in C#, it will work...
Anyone have any ideas or any alternatives so I can use Stored Procedures?
Thanks