Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a program where I have a dataset that I delete certain rows. Once I have call the delete for that row in the loop I try to update it with the data adapter. I have one of two issues.

 

If I simply run da.update(ds, "time") then is says I need a valide delete command for the data adatper. Otherwise if I have a delete command It deletes all of the rows (it's a foxpro database so it doesn't even really delete them which I need help with too.

 

da.fill(ds, "time")

 

ds.tables("time").rows(i).delete

 

del = new oledb.oledbcommand("DELETE FROM 'TIME'", co)

 

ds.update("time").rows(i).delete

 

the above is what I use for the indiviual lines of code but the above code is not complete as far as what I use. I'm guessing I'm just missinig something small and will feel stupid after hearing the answer but I don't know I've spent quite some time researching on MSDN website and google. Just looking for at least a pointer in the right direction. Thanks in advance.

 

-David silberhorn

  • 3 weeks later...
Posted (edited)

>> del = new oledb.oledbcommand("DELETE FROM 'TIME'", co)

The problem is here ... the query says Delete All Records

You must provide parameter like:

 

del = new oledb.oledbcommand("Delete from 'TIME' Where T_ID = @ID ", co)

Dim param as OleDb.OleDbParameter = New OleDb.OleDbParameter("@ID", OleDb.OleDbType.Integer))

 

del.Parameters.Add(param)

da.DeleteCommand = del

 

I hope this would help,

 

 

Zeeshan Q. Ali

Edited by makzee

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...