Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Calling a stored proc to delete records from database

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-12-02 : 08:02:28
SAM writes "I try to use a very simply stored proc to delete records in a table. The proc reads like this:

CREATE PROCEDURE sp_INV_DEL_TJCoil

@DID INT,
@DNumber VARCHAR(50),
@DBill VARCHAR(25)


AS


DELETE
FROM INV_TRANSFERS

WHERE CJID = @DID
AND COILNUMBER = @DNumber
AND BillofLading = @DBill
GO

When running this proc directly in Query Analyzer it functions correctly. But when this proc is called in my VB.NET application using the ExecuteNonQuery method in a Delete function, it returns 1 (i.e., one record is deleted from the table), but actually no record is deleted when I look at the target table. Besides, after the ExecuteNonQuery method returned 1, I cannot run a Select query to get returns from the target table because the query gets stuck (it runs very slow).

I checked the params passed from the .NET application to the proc; I checked the security and permission of the target table. Nothing is wrong. The delete function where the ExecuteNonQuery method is called is a simply function based on the sample code from MSDN.

Thank you for helping me out of this problem."

Kristen
Test

22859 Posts

Posted - 2005-12-02 : 08:11:17
Hi SAM, Welcome to SQL Team!

Has your .NET process perhaps started a transaction that it hasn't COMMITed?

Kristen
Go to Top of Page
   

- Advertisement -