Aggiornamento dati server tramite web service

mercoledì 11 luglio 2007 - 08.34

liuc Profilo | Junior Member

Ho creato una piccola applicazione windows form per provare ad aggiornare un DB tramite WebService come descritto nell'articolo 308056 della KB Microsoft.

Nell'articolo viene utilizzato un datagrid ed in effetti con questo controllo tutto funziona benissimo.

Io ho provato ad inserire delle textbox per visualizzare i dati al posto della griglia ma così facendo quando modifico i dati tali modifiche vengono ignorate nel senso che il metodo getChanges del dataset restituisce nothing (viceversa con il datagrid restituisce correttamente un oggetto).

Di seguito riporto il codice dell'applicazione nella speranza che mi sappiate dire dov'è che sbaglio.
Grazie

Public ds As DataSet


Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
LoadData()
End Sub

Private Sub LoadData()
Dim ws As New dataservice.Service
ds = ws.SELECT_DataSetContatti

Table_CONTATTOBindingSource.DataSource = ds
Table_CONTATTOBindingSource.DataMember = "Table_CONTATTO"
Me.DENOMINAZIONE1TextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.Table_CONTATTOBindingSource, "DENOMINAZIONE1", True))

End Sub

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

Dim ws As New DataService.Service
Dim dsChanges As DataSet = ds.GetChanges '<---- RESTITUISCE SEMPRE NOTHING
If dsChanges Is Nothing Then
Exit Sub
End If

dsChanges = ws.UPDATE_CONTATTO(dsChanges)

ds.AcceptChanges()
ds.EnforceConstraints = False
ds.Merge(dsChanges.Tables("Table_CONTATTO"), False, MissingSchemaAction.Ignore)
ds.AcceptChanges()
ds.EnforceConstraints = True
LoadData()
End Sub

Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5