Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete record from the table
Message
 
 
À
12/02/2003 19:14:55
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00752409
Message ID:
00752652
Vues:
19
>>> Question: If we don't have the specific ItemID to delete, what would happen?
>
>Why would you issue a delete against the table if you didn't have the ID of the row? Issuing a DELETE statement that does not remove any rows does not generate any errors from SQL.
>
>>> And how do we know, if the record was deleted or we didn't have this record to start from?
>
>Eric gave you the technical information. My questions is why would you want to know? If the row's not there, how do you have the ID to delete it with? If you're worried about concurrency, using the DELETE is a very expensive to find out - from a locking point of view. If you're really worried about it, you could do something like:
>
>
>IF EXISTS (SELECT * FROM cartDetail WHERE itemID = @id)
> DELETE FROM cartDetail WHERE itemID = @id
>
>
>-Mike
>
Hi Mike,

Can I pass this command to conn.Execute method? Basically, I'm creating a Shopping Cart application on the WEB. Firstly I want to develop a model in my mind (before starting actual coding). Here is the idea I have so far:

The result set would look like this:
Add to Cart      Remove From Cart    Select All Deselect All

checkbox   Record1 detail
checkbox   Record2 detail
...................
So, user can select some records to be added to cart or select records to remove from cart.

Now there are two problems with this model:

1) What if user would try to add record, which already exists in a cart?
2) What if user would try to delete a record, which is not yet added?

You see, what I'm trying to understand and make a workaround?

Thanks again for your help.

Also could somebody please help me with the Login Fails error? I recalled at the end of the day, that I added some user to Nortwind to make it work (it had to use similar trick to make it work with ASP.NET). But I don't remember what kind of user I added.

Now I'm unable to connect from ASP with my own database...

There are times, when you want to crash your head of the terminal...

Yesterday I riched that stage...
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform