.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 24th, 2003, 01:03 PM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
How can I REmove an Item in a DataBase ? (different way?)

Hi everybody.

I would like to know wich way I can use to delete a row in a database ?

My problem is that I have some items that need to be removed.
I know I can use a database like doing
Code:
frmItems.BindingContext(frmItems.DataSetAdresse1, "Adresse").RemoveAt(iIndex)


but using a database that need to read all the lines in it and remove the one not necessary is stupid and it's take way too much time for the program. And I also got a bug when I remove 2 or + items and that I try to access to the next item in the table.

What I was thinking of using is a OleDbCommand and OleDbReader with a query that will only search the objects that I need in SQL. and then compare them and delete the ones I don't need.

but if I use a OleDb, how do I remove the items I don't want ? is there a command for that ?

or is my only possibility the DataSet and DataRow ? or is there other way to do it ? other method or something ? if you know any others that might help me. please tell me ! every opinion and idea is welcome.

I got an headache just for thinking about how I could solve all those problems.
__________________

Reply With Quote
  #2  
Old September 24th, 2003, 01:53 PM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
would it be something like that ?

OleDBCommand.CommandText = "Delete MyTable where MyNumero = " + MyVariable + ";"

OleDBCommand.ExecuteReader

loop


???? would there be other way then this and is that the correct way to do it and correct syntax ?

Last edited by Watever : September 24th, 2003 at 01:55 PM.

Reply With Quote
  #3  
Old September 29th, 2003, 08:50 AM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
I still haven't found my problem !

what I am doing

Code:
OleDBCommand.CommandText = "Delete adresse where (norue = '" + _
                                                OleDataR.Item("norue") + "') and (noreleve = " + _
                                                "(select noreleve from releve where codeprojet = '" + _
                                                NoReleve + "'))"
OleDBCommand.ExecuteNonQuery()


it's not working, it's keep telling me
" NoRue = Invalide double type "

what the hell ?
I have done some test with select etc... and it's working but this one isn't working !


but the worst part is that the bug don't happen when I Excute but when I do the CommandText of the OleDBCommand
damn it ! just crazy today

Last edited by Watever : September 29th, 2003 at 09:23 AM.

Reply With Quote
  #4  
Old September 29th, 2003, 10:08 AM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
forget about it ! I found it !

but remember that + is not a &

and in a string use "&"

Reply With Quote
  #5  
Old September 29th, 2003, 10:57 PM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
Guys please help me ! I need to solve that problem has fast has I can !

I still have a lot of test to do and I have a final date in 2 days. I don't know how I will do that !

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > How can I REmove an Item in a DataBase ? (different way?)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap