V
Vassilis Perantzakis
This code is for a Pocket PC 2003 application:
When I check for the data by doing a
CustEditDataSet.Tables("Persons").Rows(0)("Tel") and I have changed the
textbox text I get the new value, but it is NOT saved when I call the
SQLCEDataAdapter update method.
Private editQry As String = "select idc,nomiko,Eponymo,Onoma,Tel from
Persons where idc=" + frmCustomers.selectedCust.ToString
Private adoCEDataAdapter As SqlCeDataAdapter
Private CustEditDataSet As DataSet
Private cb As SqlCeCommandBuilder
Private dt As DataTable
Private Sub frmCustEdit_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
adoCEDataAdapter = New SqlCeDataAdapter(editQry, frmConnect.adocon)
cb = New SqlCeCommandBuilder(adoCEDataAdapter)
adoCEDataAdapter.UpdateCommand = cb.GetUpdateCommand
CustEditDataSet = New DataSet
adoCEDataAdapter.Fill(CustEditDataSet, "Persons")
CustEditDataSet.AcceptChanges()
dt = CustEditDataSet.Tables("Persons")
txtSurname.DataBindings.Add(New Binding("Text", dt, "Eponymo"))
txtName.DataBindings.Add(New Binding("Text", dt, "Onoma"))
txtTel.DataBindings.Add(New Binding("Text", dt, "Tel"))
cbLegal.DataBindings.Add(New Binding("SelectedIndex", dt, "nomiko"))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
adoCEDataAdapter.Update(CustEditDataSet, "Persons")
CustEditDataSet.AcceptChanges()
Me.Close()
End Sub
When I check for the data by doing a
CustEditDataSet.Tables("Persons").Rows(0)("Tel") and I have changed the
textbox text I get the new value, but it is NOT saved when I call the
SQLCEDataAdapter update method.
Private editQry As String = "select idc,nomiko,Eponymo,Onoma,Tel from
Persons where idc=" + frmCustomers.selectedCust.ToString
Private adoCEDataAdapter As SqlCeDataAdapter
Private CustEditDataSet As DataSet
Private cb As SqlCeCommandBuilder
Private dt As DataTable
Private Sub frmCustEdit_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
adoCEDataAdapter = New SqlCeDataAdapter(editQry, frmConnect.adocon)
cb = New SqlCeCommandBuilder(adoCEDataAdapter)
adoCEDataAdapter.UpdateCommand = cb.GetUpdateCommand
CustEditDataSet = New DataSet
adoCEDataAdapter.Fill(CustEditDataSet, "Persons")
CustEditDataSet.AcceptChanges()
dt = CustEditDataSet.Tables("Persons")
txtSurname.DataBindings.Add(New Binding("Text", dt, "Eponymo"))
txtName.DataBindings.Add(New Binding("Text", dt, "Onoma"))
txtTel.DataBindings.Add(New Binding("Text", dt, "Tel"))
cbLegal.DataBindings.Add(New Binding("SelectedIndex", dt, "nomiko"))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
adoCEDataAdapter.Update(CustEditDataSet, "Persons")
CustEditDataSet.AcceptChanges()
Me.Close()
End Sub