I would like to ask regarding C#.Net
why my _DataSet.GetChanges(DataRowState.Modified) return a null value?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace test_for_error
{
public partial class Form1 : Form
{
private SqlDataAdapter _DataAdapter;
private DataSet _DataSet;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection(@"Data Source=BEB7WILLOW\BEB7WILLOW;
Database=Cost_Estimate_DB;
Trusted_Connection=No;
User ID=sa;
password=s@password1");
_DataAdapter = new SqlDataAdapter("select client_name from cost_estimate", cn);
_DataSet = new DataSet();
_DataAdapter.Fill(_DataSet, "cost_estimate");
this.txtClient.DataBindings.Add("Text", _DataSet, "cost_estimate.client_name", true, DataSourceUpdateMode.OnPropertyChanged);
}
private void btnSave_Click(object sender, EventArgs e)
{
_DataSet.AcceptChanges();
DataSet DatasetChanges = _DataSet.GetChanges(DataRowState.Modified);
}
}
}