Skip to main content

Microsoft Silverlight

Unanswered Question LinQ and WebserviceRSS Feed

(0)

slen
slen

Member

Member

10 points

59 Posts

LinQ and Webservice

I have problem in inserting new row into database.

 In file svc

1    Public Sub InsertCountry(ByVal newItem As ketsb_enum_country) Implements IServiceCountry.InsertCountry   
2 Dim db As New CountryDataContext
3 db.countTbl.InsertOnSubmit(newItem)
4 db.SubmitChanges()
5 End Sub
6

  Code behind for XAML file

Private Sub Page_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
webService = New ServiceReference2.ServiceCountryClient
AddHandler webService.InsertCountryCompleted, AddressOf webService_InsertCountryCompleted
End Sub

'This is called after executing
Private Sub webService_InsertCountryCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
Browser.HtmlPage.Window.Alert("Inserted Successful!!!")
End Sub


Private Sub
Ok_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Dim newItem As CountrySilverlight.ServiceReference2.ketsb_enum_country = New CountrySilverlight.ServiceReference2.ketsb_enum_country
.....
webService.InsertCountryAsync(newItem)
End Sub

  

Does anyone has any idea why this newItem cannot enter a record into the database...? All the others like update and delete work okay ...

Thanks

 

Ken Tucker
Ken Tucker

All-Star

All-Star

16324 points

2,493 Posts

Re: LinQ and Webservice

In the InserCountryComplete procedure are you getting anything in the e.error?  I suspect that maybe you are missing a required field

slen
slen

Member

Member

10 points

59 Posts

Re: Re: LinQ and Webservice

I think there isn't any error when executing the InsertCountryCompleted

The following is the message I got from e.error()

System.ServiceModel.CommunicationException: The remote server returned an error: NotFound ---> System.Net.WebException: The remote server returned an error: NotFound ---> System.Net.WebException: The remote server returned an error: NotFound

.....

Really no one knows the problem?

Mog Liang - MSFT
Mog Lian...

All-Star

All-Star

15894 points

1,542 Posts

Re: LinQ and Webservice

Someone encountered similar problem before.

Please check if some of the insert entity's fields conflict with database table constraint

Mog Liang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities