This is a simple winform im creating that when you click a button it will gather data from a combo box and then add data to a database here is the button event code.
private void button1_Click_1(object sender, EventArgs e)
{
Database1Entities5 enti开发者_如何学编程ties = new Database1Entities5();
int personOneID = entities.People.Where(p => p.Name == _PersonOne).FirstOrDefault().PersonID;
int personTwoID = entities.People.Where(p => p.Name == _PersonTwo).FirstOrDefault().PersonID;
int amount = _Amount;
int TypeID = entities.Types.Where(t => t.Name == _Type).FirstOrDefault().TypeID;
Money m = Money.CreateMoney(personOneID, personTwoID, TypeID, _Amount, DateTime.Now, CommentTextBox.Text);
entities.Moneys.AddObject(m);
entities.SaveChanges();
//
}
when i click the button nothing happens, during debuging the Money m is created fine; i have no idea whats going on, any help would be appreciated.
精彩评论