Deleted in DataSet not in DB

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..
 
tnx

tnx dude, sadly it didnt work...
i was able to catch some errors though but the deletion did happen...
i already had this line on my code...
dataadapter.update(dataset, "tablename")

anyways thnx for the help... if you come up with any suggestions i would love to here 'em...
 
Sub DelUser(ByVal IDstr As String, ByVal DSet As DataSet)

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

delcom.

Try

MyAdpUser.Update(MyDstUser, "Users")

Catch ex As Exception

MsgBox(ex.ToString)

End Try

this isnt working...

i have also tried using parameters... still didnt work...

im hoping there's still another approach that i could use...
im kinda stuck, in this part of my study...
 
hI,


cjaymcmeans said:
DelSet.Tables("Users").GetChanges(DataRowState.Deleted).Rows.Count =nothing


u r Dataadpter with Delete Only Those records for which RowState is mark as Deleted................But as said U r getting Value nothing that means ur rowstate has been Reseted(might be...............)

i would be better if u send be message at ritesh.jain@btc.com.tr so it will be convinient to track the problem...........

Ritesh
 
Back
Top