我创建了一个方法,用数据源对表进行数据绑定。:
private void AddDataBinding()
{
txtID.DataBindings.Add("Text", ds, "Ticket.RaffleID");
cboName.DataBindings.Add("Value", ds, "Ticket.CustomerID");
dtpDate.DataBindings.Add("Value", ds, "Ticket.Date");
txtStore.DataBindings.Add("Text", ds, "Ticket.Store");
txtAmount.DataBindings.Add("Text", ds, "Ticket.Amount");
txtStub.DataBindings.Add("Text", ds, "Ticket.NoStub");
cm = (CurrencyManager)this.BindingContext[ds, "Ticket"];
}
private void frmCustomerTicket_Load(object sender, EventArgs e)
{
OpenConnection();
AddDataBinding();
}
当我运行代码时,此消息显示:“无法创建字段故障单的子列表。”