well I have been looking for the solution for two days for this small question but still no proper answer so plz don't ignore or put crap comments

this is what I want ,I got two tables in my Access DataBase which connected with One-to-Many Relationship and I also use DataSet with CommandBuilder in my C# Project

I don't know much more about DataBase cause I have learned about DataBase from Home and Learn site (both Access and SQL) recently and still know how to work with one table or multiple where there no relationship but in this case I want to use Two Tables with relationship

this is part of my project

private void btnloginsubmit_Click(object sender, EventArgs e)
            if (validation() == true)
                _accessAda.SelectCommand = _accessCommand; //give the connection's detail and command string (the default command string about to add first table)
                _accessCom = new System.Data.OleDb.OleDbCommandBuilder(_accessAda); //reopen the connection
                _accessAda.Fill(_accessSet, "tblProject");
                _accessCon.Close(); //close the connection
                Console.WriteLine("number of tables returned {0}", _accessSet.Tables.Count);
                _arrayRow = _accessSet.Tables["tblProject"].Select("user_userName='" + _userName + "'"); //get the user name
                Console.WriteLine("got the row");

                if (_arrayRow.Length > 0) //if available
                    _singleRow = _arrayRow[0]; //get that row;
                    if (_userPassword == _singleRow["user_password"].ToString()) //check the password is correct
                        _singleRow["user_lastVisited"] = DateTime.Now; //get the last visited date;

                        _accessCom = new System.Data.OleDb.OleDbCommandBuilder(_accessAda); //reopen the connection
                        _accessAda.Update(_accessSet, "tblProject");@@**
                        Console.WriteLine("everything done");
                        dataPulling(); //data pulling step
                        Console.WriteLine("password is incorrect.!!");
                        MessageBox.Show("password is incorrect.!!");
                    Console.WriteLine("there is no such a user name found in the database");
                    MessageBox.Show("there is no such a user name found in the database");


@@**here I got a trouble when I use CommandBuilder cause I Bound two tables into a Query so it says can't update Multiple Tables ,obviously it might be cause DataAdapter doesn't know which table need to pick to update but I don't know any other alternative way to do this work ,that's what I really need to know

I could find some suggestions
return Tables separately and Insert Data into them and Update separately using CommandBuilder also use InsertCommand with CommandText Properties
<- but there is a relationship ah.? also I don't like this method cause I can't see it's a effective way to work with databases

I need alternative way to Update the Query(got Two Tables with it)beside CommandBuilder I believe there should be a way to do that.


Votes + Comments
Bad title. Also doesn't know how to spell "Please"
8 Years
Discussion Span
Last Post by finito

Maybe someone would want to help you if you were to spell please correctly...

wtf . what does that mean.? show me any place I have done any spelling mistake.


Hello Orion2K.

I am unclear as to what you want to do.

Can you please write the Update statement for each table and also state their relations and primary keys.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.