Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created one sp that tuncate table.Table name is dynamic.Here I used dynamic sql.Sp is working fine.I want to execute that sp from C#.net(from cs file). I know executenonquery returns no of row affected.executenonquery is used for insert,update and delete command.Exectesclare is used for select which has only one cell.EceuteReader is used for selecting multiple record.What shall i use that tell my tuncate table clause executed properly or not?

asp.net
Posted
Updated 23-Sep-15 20:16pm
v2
Comments
Tomas Takac 24-Sep-15 2:18am    
What's the problem here? Do you get an error while running the SP?

1 solution

After TRUNCATE, count the rows of that table inside the procedure. In code, check if count is 0, then the operation is successful, otherwise not.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900