0) Use a parameterized query
1) If ID is an
int
, why put it in apostrophes?
2) Use
using
statements
3) No need for
if (Dbid != null)
4) Why not simply use an
INSERT/SELECT
statement?
INSERT INTO Add_Comment(Id,User_Comments)
SELECT ID,@User_Comments
FROM MapDataImage
WHERE Source=@Source AND Destination=@Destination