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
 General SQL Server Forums
 New to SQL Server Programming
 Deletion Problem in sql table

Author  Topic 

hotshot_21
Yak Posting Veteran

97 Posts

Posted - 2006-01-02 : 00:01:18
i am using this statement for deleting a single row in sql table.
"DELETE FROM Random WHERE NewID= '" & strwinner & "'"

where "strwinner" is the variable which contains the row to be deleted.
the problem is that when i check the table in sql the row which was supposed to be deleted is sitll there.it does not give me any error statement or something.
iam executing this statement by using ExecuteNonQuery in my .aspx page.
please help

SamC
White Water Yakist

3467 Posts

Posted - 2006-01-02 : 05:27:21
If the WHERE condition isn't met, there is no error DELETEing. @@ROWCOUNT will return the number of rows deleted.

My guess is column NewID in table Random does not equal the value in strwinner. Why don't you post some sample data for the value NewID and the value in strwinner?
Go to Top of Page

hotshot_21
Yak Posting Veteran

97 Posts

Posted - 2006-01-02 : 05:37:32
got that problem solved thanks for ur response
Go to Top of Page

sachinsamuel
Constraint Violating Yak Guru

383 Posts

Posted - 2006-01-02 : 05:37:39
Also try using ltrim() and rtrim() to NewID. May be space is the culprit?


Regards
Sachin

Don't sit back because of failure. It will come back to check if you still available. -- Binu
Go to Top of Page
   

- Advertisement -