views:

32

answers:

0

Hi all!

I have the following situation - three tables in the db : - um_users (id, name) - um_roles (id, description) - um_user_roles (user_id, role_id)

I load into a data set two datatables : the "users" one, and another one build on the other two, like this :

_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_user_roles");
      _usersDataSet.Relations.Add("users_uur", _usersDataSet.Tables[0].Columns["USER_ID"], _usersDataSet.Tables[1].Columns["user_id"]);

This snippet also adds a relation between the two.

I display them in a ultrawingrid from infragistics, and I'm able to edit them. Saving the modifications for the first table worked with no problem,but since the second one is more like a view, i have no ideea how should i proceed. should i build an insert command or how ?

Thanks!