Skip to main content
Home Forums Silverlight Programming Programming with .NET - General LinQ and Webservice
3 replies. Latest Post by Mog Liang - MSFT on July 10, 2009.
(0)
slen
Member
10 points
59 Posts
07-07-2009 1:09 AM |
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 CountryDataContext3 db.countTbl.InsertOnSubmit(newItem)4 db.SubmitChanges()5 End Sub6
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_InsertCountryCompletedEnd 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
All-Star
16324 points
2,493 Posts
07-07-2009 6:19 AM |
In the InserCountryComplete procedure are you getting anything in the e.error? I suspect that maybe you are missing a required field
07-07-2009 9:09 PM |
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 Lian...
15894 points
1,542 Posts
07-10-2009 3:23 AM |
Someone encountered similar problem before.
Please check if some of the insert entity's fields conflict with database table constraint