How are you calling the stored procedure? you need something like below:
SqlConnection conn = new SqlConnection(myConnectionString);
SqlCommand execProc = new SqlCommand("DelProc", conn);
execProc.CommandType = CommandType.StoredProcedure;
execProc.Parameters.Add("@original_ID ", SqlDbType.NVarChar, 255).Value =
YourValue;
execProc.ExecuteScalar();
Hope that helps,
Alex.
"Jim Andersen" <no****@nospam.dk> wrote in message
news:e5**************@TK2MSFTNGP11.phx.gbl...
Just to let you know, and to help any future sorry sods who gets trapped
in the same black hole......
You can't just copy/move a working sql-statement into a stored procedure.
Working with a sqldatasource. Conflictdetection set to compareallvalues.
Oldvaluesparameterformatstring set to original_{0}
tblA has 2 fields. ID and MyText.
Deletecommand="Delete from tblA where ID=@original_ID"
No deleteparameters.
Works great.
Ok, so I've finished testing, and wanna move from embedded sql to using
stored procs instead.
So I change
Deletecommand="DelProc"
and
create DelProc (
@original_ID as nvarchar (255)
)
as
Delete from tblA where ID=@original_ID
BUT... I get errors stating there are too many arguments (or parameters)
to DelProc. I have to change DelProc to
create DelProc (
@original_ID as nvarchar (255),
@original_MyText as nvarchar (255)
)
even though I don't use @original_MyText but have the same Delete
statement as before.
/jim