anyone? do you have a problem like this? for example,
Illegal attempt to associate a collection with two open sessions
i update one user appear top error.
the code is:
Code:
GridViewRow row=(GridViewRow)(((DropDownList)sender).Parent.Parent);
int id = Convert.ToInt32(mygrid.DataKeys[row.RowIndex].Values["Userid"]);
DropDownList ddl = (DropDownList)mygrid.Rows[row.RowIndex].FindControl("ddlist_state");
int state = Convert.ToInt32(ddl.SelectedValue);
UserinfoDao dao = DB.GetUserinfoObject();
Userinfo user = dao.FindUser(id);
user.State = state;
dao.UpdateUser(user);
public Userinfo FindUser(int userid)
{
return (Userinfo)Session.Load(typeof(Userinfo),userid);
}
public void UpdateUser(Userinfo user)
{
Session.Update(user);
}
additional my mappping xml is one to many,
Thanks in advance.