northwinddataset = (NORTHWNDDataSet)bsEmployees.DataSource;
下面代码中的实际含义是什么?它是northwinddataset 实例的数据源?
public partial class FormEdit : Form
{
BindingSource bsEmployees;
NORTHWNDDataSet northwinddataset;
EmployeesTableAdapter taEmployees;
public FormEdit(BindingSource bsEmployees)
{
InitializeComponent();
this.bsEmployees = bsEmployees;
taEmployees = new EmployeesTableAdapter();
/***** This line *****/
northwinddataset = (NORTHWNDDataSet)bsEmployees.DataSource;
/*********************/
}
private void FormEdit_Load(object sender, EventArgs e)
{
try
{
tbLastName.DataBindings.Add("Text", bsEmployees, northwinddataset.Employees.LastNameColumn.ColumnName);
tbFirstName.DataBindings.Add("Text", bsEmployees, northwinddataset.Employees.FirstNameColumn.ColumnName);
tbTitle.DataBindings.Add("Text", bsEmployees,
}
catch (Exception ex)
{
MessageBox.Show(string.Format("Greska: {0}", ex.Message));
Close();
}
}
private void btnSnimi_Click(object sender, EventArgs e)
{
bsEmployees.EndEdit();
if (taEmployees.Update(northwinddataset.Employees)> 0)
{
MessageBox.Show("Recorded");
Close();
}