Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2715
3 tables,parent and child
posted

Hi!

I'm using an ultragrid control for displaying and editing data from a db. the data is stored in 3 tables :

- users (user_id, name)
- roles (role_id, role_name)
- user_roles(user_id, role_id);

I managed to add them to a dataset, and display it in the ultragrid using this code :

_cmd = new OracleCommand("select * from um_users", _conn);

_odaUsers = new OracleDataAdapter();

_usersDataSet = new DataSet("um_users");

_odaUsers.SelectCommand = _cmd;

_odaUsers.Fill(_usersDataSet, "um_users");


_cmd = new OracleCommand("select u.user_id, r.role_id, r.role_name, r.descr " +

"from um_users u " +

"inner join um_user_roles ur on u.user_id = ur.user_id " +

"inner join um_roles r on ur.role_id = r.role_id ", _conn);

_odaUsers.SelectCommand = _cmd;

_odaUsers.Fill(_usersDataSet, "um_users_roles");

 

 

_usersDataSet.Relations.Add("users_uur", _usersDataSet.Tables[0].Columns["USER_ID"], _usersDataSet.Tables[1].Columns["user_id"]);

This snippet allows me to display the data corectly 
and save it for the parent users band, but
does not do the job after editing or inserting
 a new row in the child roles band.
What am i missing, what should i do in
order that the data displayed in in child band to
be saved
corectly ?

thanks,
Marius.
Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Marius,

    I'm not sure I understand the issue. When you say the data is not getting saved, do you mean saved to the local DataSet or saved to the back end (the database).

    The grid only deals with the local data source. So if the data is not getting saved to the DataSet, then something is wrong. But I can't imagine any reason why that would happen. I don't think it's even possible, unless the DataSet is rejecting the changes for some reason. In which case, the grid cell woul revert to it's original value as soon as you leave the cell. But since you didn't mention anything like that, I assume that's not the case.

    If you are asking about how to update the back end, then typically, you would use a DataAdapter for that. But that part of it isn't related to the grid or the UI, so it would be best for you to check out Microsoft's documentation.

Children
No Data