|
-
Apr 12th, 2008, 03:50 PM
#1
Thread Starter
Lively Member
[2005] How to delete multiple rows
Haiii...
What i wan to do is to delete multiple rows in database. I use this line code to delete it.
Code:
DELETE FROM TempCalculation
In sql its work find. But when i run it from VB.net, vb.net return error message that it does not support multiple deletion of multiple rows in database. Thus any of u guys have sulotion for ths things.
Thank U
-
Apr 12th, 2008, 07:06 PM
#2
Thread Starter
Lively Member
Re: [2005] How to delete multiple rows
Can anyone figure this out
-
Apr 12th, 2008, 11:03 PM
#3
Re: [2005] How to delete multiple rows
You need to think about what information we might need to solve a problem. You description is pretty vague given that we know nothing about what you're doing. What database are you using? Exactly what code are you executing? What is the exact error message? Provide a complete and clear description of what you want to do, what you are doing and what goes wrong and then you maximise the chance of our being able to help.
-
Apr 12th, 2008, 11:24 PM
#4
Thread Starter
Lively Member
Re: [2005] How to delete multiple rows
Actually the database is just a temp table. i use just to store and sum data. After the data have been sum then the data shall be transfer into another table.
What i want is to clear up the table after sum.
I use this line of code.
vb Code:
Dim command4 As New SqlCommand("DELETE FROM TempCalculation", Conn) command4.BeginExecuteNonQuery()
The error was this "The connection does not support MultipleActiveResultSets."
-
Apr 13th, 2008, 08:31 AM
#5
Re: [2005] How to delete multiple rows
No, the database is NOT just a temp table. The database may contain a temp table and it may be that temp table that you're trying to delete from, but the database is SQL Server, which I can tell from the fact that you're using an SqlCommand. Also, this:
The connection does not support MultipleActiveResultSets.
bears no resemblance to this:
it does not support multiple deletion of multiple rows in database
They are completely different things. This is why you need to provide clear and complete information in the first place. If the IDE gives you an error message then give us the same error message. Don't paraphrase and end up turning it into something completely unrelated.
That error message is telling you that you're trying to use multiple active result sets (MARS) without having configured the connection to support it, which you would do by setting the MultipleActiveResultSets key to True in the connection string. Basically, enabling MARS allows you to use an SqlConnection to execute other SQL statements while there is an SqlDataReader open on that connection. To fix this you have three options:
1. Close the SqlDataReader before executing another SqlCommand.
2. Use a second SqlConnection to execute the second command while the data reader is still open.
3. Enable MARS on your SqlConnection.
If you want to go with option 3 then you can look up how to do so on MSDN. Note that MARS requires SQL Server 2005.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|