This topic is locked
[SOLVED]

 Execute Stored Procedure passing id of just added record

11/18/2013 2:47:32 AM
ASPRunner.NET General questions
M
marcoardiawenink author

Hi,
In the after record added event I want to execute a stored procedure (SQL Server) with the id of the added record as a parameter.
If I try
string strSQL = "EXEC dbo.StoredProcedure '" + values["id"] +"'";

CommonFunctions.db_exec(strSQL.ToString(), null);
The procedure gets executed, but the id doesn't get passed.

Waht is the way to do this ? The id is a uniqueidentifier.
Thanks!

M
marcoardiawenink author 11/18/2013

Figured it out <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=72908&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' />
If I put the parameter in a string first it gets parsed into the strSQL string:
string strId=values["id"];

string strSQL = "EXEC dbo.StoredProcedure '" + strId +"'";

CommonFunctions.db_exec(strSQL, null);