954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

stored procedure does not delete row

Hello I use this code as a stored procedure to delete row of the table:

ALTER PROCEDURE dbo.DeleteRowMaterialTyp
(
@CisloParam varchar(MAX) /* hodnota v tabulke, ktora nam identifikuje riadok, ktory sa ma zmazat */
)
AS
Delete From MaterialTyp Where Cislo = @CisloParam
RETURN

And this is code where I call this procedure: EtiketyLINQDataContext EtiketyData = new EtiketyLINQDataContext();
string CurrentRowCellParam = LINQdataGridView.CurrentRow.Cells[0].Value.ToString();
EtiketyData.DeleteRowMaterialTyp(CurrentRowCellParam);

It's quite strange to me, because when I execute this DeleteRowMaterialTyp stored procedure, it deletes, also when I use deletion in running application, deletion works again, i can see it on datagridview, but when I come back to the sql environment and manually make selection of the datas, I can see, that nothing has been deleted. Where is the problem? Shall I do something additional between sql database and linq class dbml?

matejkralik
Newbie Poster
24 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

2 things come to mind.

1. Is it actually calling the DeleteRowMaterialTyp ? eg, if you changed it to log to a new table like a syslog table to say "I was here with param: xxx" . does it do it?
2. is the value of CurrentRowCellparam what you think it is?

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

aha, ok, I think that problem maybe more, that it cannot touch MaterialTyp table...hmm, but anyway, this touches the storedprocedure DeleteRowMaterialTable, which is called with this line:

EtiketyLINQDataContext EtiketyData = new EtiketyLINQDataContext();

so where is the solution?

because I already used messagebox to see currentrow.cell value that I need...

matejkralik
Newbie Poster
24 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

As I suggested, make a new table and adjust the stored procedure to append to a form of log file to say "Hi I was here" so you know it at least called it and that it received the parameter etc.

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

Could please describe me step by step what to do with this log file?

matejkralik
Newbie Poster
24 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

um, well the idea is to prove that the call is successfully running so the point is to use an additional table as a debug state to say

I got to this point with this value
I got to that point with this value
I didnt do that
I did this

so you can tell from the table where abouts your code failed.

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

After all I found the solution here :

I do not know how to execute delete, insert, update using datacontext...I really don't know, so I just joined the database...

matejkralik
Newbie Poster
24 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You