cjaymcmeans
Well-known member
- Joined
- Jan 12, 2005
- Messages
- 85
- Programming Experience
- 3-5
im having trouble deleting records in my database.. i just started using vs.net...
i was successful in deleting rows in datasets.. my problem is that i want to delete the records also... i've used oledbcommands... command adapters but sadly i am yet to succeed in deleting the rows that i have deleted in the dataset in the database... hope you guys can help..
Dim DelPrm As OleDb.OleDbParameter
Dim DelCom As New OleDbCommand
DelCom.CommandText = ("delete from users where userid='" & Trim(IDstr) & "'")
DelCom.Connection = XConn
'DelCom.CreateParameter()
'DelPrm = DelCom.Parameters.Add("@UID", IDstr)
'DelPrm.SourceVersion = DataRowVersion.Original
MyAdpUser = Nothing
MyAdpUser = New OleDbDataAdapter
MyAdpUser.DeleteCommand = DelCom
Try
MyAdpUser.Update(MyDstUser, "Users")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
this doesnt seem to work... i dont know why...
im kinda stuck here... so im very much open to any suggestion you guy might come up with... tnx...
i was successful in deleting rows in datasets.. my problem is that i want to delete the records also... i've used oledbcommands... command adapters but sadly i am yet to succeed in deleting the rows that i have deleted in the dataset in the database... hope you guys can help..
Dim DelPrm As OleDb.OleDbParameter
Dim DelCom As New OleDbCommand
DelCom.CommandText = ("delete from users where userid='" & Trim(IDstr) & "'")
DelCom.Connection = XConn
'DelCom.CreateParameter()
'DelPrm = DelCom.Parameters.Add("@UID", IDstr)
'DelPrm.SourceVersion = DataRowVersion.Original
MyAdpUser = Nothing
MyAdpUser = New OleDbDataAdapter
MyAdpUser.DeleteCommand = DelCom
Try
MyAdpUser.Update(MyDstUser, "Users")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
this doesnt seem to work... i dont know why...
im kinda stuck here... so im very much open to any suggestion you guy might come up with... tnx...