Y
YK Ng
Hi,
I retrieve a customer row from the Northwind database
into a DataSet and bind it to a number of text boxes as
follows:
private void BindData(string custID)
{
m_dsCust = m_custDAL.Load(custID);
txtCompanyName.DataBinding.Add(
"Text", m_dsCust, "Customer.CompanyName");
txtContactName.DataBinding.Add(
"Text", m_dsCust, "Customer.ContactName");
txtContactTitle.DataBinding.Add(
"Text", m_dsCust, "Customer.ContactTitle");
}
Next, I changed the company name by typing some text into
the bound text box (txtCompanyName). Then, I click a
button to retrieve the changes that I made and attempt to
update it as follows:
private void Button1_Click(object sender, EventArgs e)
{
DataSet changes =
m_dsCust.GetChanges(DataRowState.Modified);
m_custDAL.Save(changes);
}
I supposed the GetChanges() should return a DataSet with
the "Customer" table and a row (i.e., the only row I
retrieved) because I changed its Company Name. However, I
get "null" from GetChanges().
Am I doing anything wrong? Or, is there something hidden
I don't know?
Please advise.
I retrieve a customer row from the Northwind database
into a DataSet and bind it to a number of text boxes as
follows:
private void BindData(string custID)
{
m_dsCust = m_custDAL.Load(custID);
txtCompanyName.DataBinding.Add(
"Text", m_dsCust, "Customer.CompanyName");
txtContactName.DataBinding.Add(
"Text", m_dsCust, "Customer.ContactName");
txtContactTitle.DataBinding.Add(
"Text", m_dsCust, "Customer.ContactTitle");
}
Next, I changed the company name by typing some text into
the bound text box (txtCompanyName). Then, I click a
button to retrieve the changes that I made and attempt to
update it as follows:
private void Button1_Click(object sender, EventArgs e)
{
DataSet changes =
m_dsCust.GetChanges(DataRowState.Modified);
m_custDAL.Save(changes);
}
I supposed the GetChanges() should return a DataSet with
the "Customer" table and a row (i.e., the only row I
retrieved) because I changed its Company Name. However, I
get "null" from GetChanges().
Am I doing anything wrong? Or, is there something hidden
I don't know?
Please advise.