Problem with my Code

N

Nijazi Halimaji

This is my code I am using (see bottom for my questions)



Public Sub SendAllSMS()

Dim myODBC As New clsODBCDataSMSVers

Dim ds As New Data.DataSet

ds = myODBC.GetAllSMStoSend

Dim dsnotSent As DataSet

dsnotSent = ds.Clone

Dim mySMSWebService As New SendSMSbyService

mySMSWebService.ServerIP = "138.188.82.160"

mySMSWebService.ServerPort = "3044"

mySMSWebService.LargeAccountName = "30016"

mySMSWebService.LargeAccountPassword = "super30016"

For Each row As DataRow In ds.Tables(0).Rows

mySMSWebService.AddSMS(row.Item("SMSVersNr").ToString,
row.Item("NatelNr").ToString, row.Item("Nachricht").ToString,
row.Item("NatelRueckNr").ToString)

Next

If mySMSWebService.SendSMS = False Then

Dim answer As DataSet

answer = mySMSWebService.GetNotSendSMS

For Each row As DataRow In ds.Tables(0).Rows

Dim checkrow() As DataRow

Dim id As String

Try

checkrow = answer.Tables(0).Select("id='" & row.Item("SMSVersNr").ToString &
"'")

id = checkrow(0).Item("id").ToString

Catch e As Exception

id = ""

End Try

If row.Item("SMSVersNr").ToString = id Then

row.Item("AnzahlVersuche") = row.Item("AnzahlVersuche") + 1

'

dsnotSent.Tables(0).ImportRow(row)

row.Delete()

End If



Next

ds.AcceptChanges()

End If

For Each row As DataRow In ds.Tables(0).Rows

row.Item("VersandDatum") = Now

row.Item("VersandZeit") = Now

Next

myODBC.SaveChangesSent(ds)

myODBC.SaveChangesNotSent(dsnotSent)

End Sub



When I finally execute myODBC.SaveChangesNotSent(dsnotSent) then I get the
exeption: "Concurrency violation: the UpdateCommand affected 0 of the
expected 1 records."



I know that there is something with my row handling, because when I execute
the same command seperately without this row-things, then everything works
fine...



Maybe someone has help for me?



Thanks alot



Nijazi Halimaji
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top