Below, I'm calling one stored procedure from c#.net windows forms.
The stored procedure contains following:
exec master..xp_cmdshell ''bcp "select ''''Column1'''',''''Column2'''',''''Column3'''',''''Column4'''',''''Column4'''',''''Column5'''',''''Column6'''',''''Column7'''',''''Column8''''" queryout "' + @Parent_Folder + @Transformed_Tbl + '.csv" -c -t, -T -Slocalhost'''
exec master..xp_cmdshell ''bcp Databasename..' + @database table+ ' out "' + @serverfolder+ 'temp_' + @user specified file name + '.csv" -c -t, -T -Slocalhost'''
exec master..xp_cmdshell ''copy /b "' + @serverfolder+ @user specified file name + '.csv" + "' + @serverfolder+ 'temp_' + @user specified file name + '.csv" "' + @serverfolder + @user specified file name+ '.csv"'''
It's running perfectly,
but some times users want to cancel this process. How can I cancel this running bcp process when the user hits the cancel button. Here is my application in my local system and I am accessing Database from another sql server system then saving the file in same sql server system.
Kindly give me an idea about this issue.