Click here to Skip to main content
15,890,825 members
Home / Discussions / Database
   

Database

 
Questionchecking the fieldname in the table Pin
Dhyanga13-Jun-11 9:42
Dhyanga13-Jun-11 9:42 
AnswerRe: checking the fieldname in the table Pin
PIEBALDconsult13-Jun-11 14:48
mvePIEBALDconsult13-Jun-11 14:48 
AnswerRe: checking the fieldname in the table Pin
Mohamad Kaifi13-Jun-11 23:53
Mohamad Kaifi13-Jun-11 23:53 
GeneralRe: checking the fieldname in the table Pin
PIEBALDconsult14-Jun-11 2:53
mvePIEBALDconsult14-Jun-11 2:53 
GeneralRe: checking the fieldname in the table Pin
Dhyanga14-Jun-11 3:10
Dhyanga14-Jun-11 3:10 
AnswerRe: checking the fieldname in the table Pin
Simon_Whale14-Jun-11 3:04
Simon_Whale14-Jun-11 3:04 
GeneralRe: checking the fieldname in the table Pin
Dhyanga14-Jun-11 3:12
Dhyanga14-Jun-11 3:12 
QuestionComparing Table Entries Using C# and MS Access Pin
VonHagNDaz13-Jun-11 8:16
VonHagNDaz13-Jun-11 8:16 
Hey Guys,

Saying I'm a rookie at databases would be giving me too much credit. That said, I'm working on a project where a manager can create a job for his employees. Each employee is stored in a table tblUsers and each job is stored in a table tblJobs. Now I know I have a few problems with the way my DB is set up. tblUsers has a primary key of UserName and tblJobs has a primary key of Job Descriptions. Each entry in tblJobs has a linked key, UserName from tblUsers is linked to Project lead from tblJobs.

I have two ArrayLists, jobs and copyOfJobs. When a manager signs in, copyOfJobs is passed to what I call ManagerForm. In ManagerForm, the manager can make alterations to copyOfJobs, and once he exits, I want to compare jobs with copyOfJobs. The contents of jobs is pulled from an Access Database, then copied to copyOfJobs. Once ManagerForm is closed, I want to compare jobs to copyOfJobs. Durring the comparison I want to check if things such as project name, project lead, duedate for a particular assignment has changed. If changed, I want it removed from the database and reinserted with the new values. I'm completely stuck! Any advice/comments would be greatly appreciated.

Here is some code to prove I've actually messed around with this before coming to you guys.

public void GetUsers(ArrayList users)
{
    object[] userData = new object[4];

    OleDbCommand dbCommand = new OleDbCommand("SELECT * FROM tblUsers", this._dbConnection);

    try
    {
        OleDbDataReader dbReader = dbCommand.ExecuteReader();

        while (dbReader.Read())
        {
            User currentUser = new User();
            dbReader.GetValues(userData);

            //get user name
            currentUser.Name = userData[0].ToString();
            //get password
            currentUser.Password = userData[1].ToString();
            //get rights
            string temp = userData[2].ToString();
            int rights = Convert.ToInt16(temp);
            currentUser.Rights = (User.EN_RIGHTS)rights;
            //get jobs
            //still thinking about this one


            users.Add(currentUser);
        }
        dbReader.Close();
    }
    catch (Exception e)
    {
        String temp = String.Format("DBManager::GetUsers: {0}", e.Message);
        MessageBox.Show(temp);
    }
}

pretty simple, probably not the best way.

and here is the method stub that I'm working on so far
public void UpdateJobs(ArrayList copyOfJobs, ArrayList originalJobs)
{
    ArrayList copy = new ArrayList();
    ArrayList original = new ArrayList();

    copy = copyOfJobs;
    original = originalJobs;

    string temp = "";

    if (!copy.Equals(original))
    {
        temp = string.Format("");

        for (int i = 0; i < copyOfJobs.Count; i++)
        {

        }
    }
}

[Insert Witty Sig Here]

AnswerRe: Comparing Table Entries Using C# and MS Access Pin
Johan Hakkesteegt27-Jun-11 0:06
Johan Hakkesteegt27-Jun-11 0:06 
QuestionHow to remove column "rowguid" from table in SQL server 2008? Pin
Hy Chanhan13-Jun-11 5:53
professionalHy Chanhan13-Jun-11 5:53 
AnswerRe: How to remove column "rowguid" from table in SQL server 2008? Pin
Hy Chanhan13-Jun-11 17:48
professionalHy Chanhan13-Jun-11 17:48 
QuestionRow by row error handling in Table value parameter in SQL 2008 Pin
Lijo Rajan13-Jun-11 5:22
Lijo Rajan13-Jun-11 5:22 
Question[SSIS 2008] - Global transformation method for GUID fields Pin
phil.o13-Jun-11 0:45
professionalphil.o13-Jun-11 0:45 
QuestionRecordset Seek - multiple fields Pin
john john mackey10-Jun-11 13:35
john john mackey10-Jun-11 13:35 
AnswerRe: Recordset Seek - multiple fields Pin
Eddy Vluggen11-Jun-11 1:00
professionalEddy Vluggen11-Jun-11 1:00 
Questionmoving column in sql Pin
Milad.Biroonvand10-Jun-11 9:32
Milad.Biroonvand10-Jun-11 9:32 
AnswerRe: moving column in sql Pin
GenJerDan10-Jun-11 11:21
GenJerDan10-Jun-11 11:21 
AnswerRe: moving column in sql Pin
David Skelly12-Jun-11 22:40
David Skelly12-Jun-11 22:40 
GeneralRe: moving column in sql Pin
Milad.Biroonvand13-Jun-11 7:50
Milad.Biroonvand13-Jun-11 7:50 
AnswerRe: moving column in sql Pin
thatraja13-Jun-11 0:03
professionalthatraja13-Jun-11 0:03 
GeneralRe: moving column in sql Pin
Milad.Biroonvand13-Jun-11 7:53
Milad.Biroonvand13-Jun-11 7:53 
GeneralRe: moving column in sql Pin
Pete O'Hanlon13-Jun-11 9:01
mvePete O'Hanlon13-Jun-11 9:01 
QuestionGet Percentages Of Rows With Date In Them - Grouped Pin
Kevin Marois10-Jun-11 5:48
professionalKevin Marois10-Jun-11 5:48 
QuestionSQL Function problem Pin
Etienne_12310-Jun-11 0:07
Etienne_12310-Jun-11 0:07 
AnswerRe: SQL Function problem Pin
PIEBALDconsult10-Jun-11 2:47
mvePIEBALDconsult10-Jun-11 2:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.