Dataset or Datareader? - C# NET programming

Asked

Viewed 92 times

0

Data-driven projects are widely used in desktop applications, I’m with a library project that saves member records. I’m using the method of Application in 3 layers, consists of a lot of efficiency and keeps the code clean. In Dataset: I want an ambiguity of the key user both in the same and in the database. Follow an example of the code I am using:

public int InsertMembro(Membro m)
    {
        string sexo;
        int key;

        if (m.MemberSexo == MembroSexo.Feminino)
            sexo = "F";
        else
            sexo = "M";
        //Insere na base de dados
        key = (int) usersTBL.MembroINSERT(m.MemberName,
            m.MemberRG, m.MemberEndereço, m.MemberBairro, m.MemberCidade, m.MemberNascimento, m.MemberTelefone,
            m.MemberEscola, sexo);

        //Salva os dados no DataSet
        dataset.Users.AddUsersRow(m.MemberName,
            m.MemberRG, m.MemberEndereço, m.MemberBairro, m.MemberCidade, m.MemberNascimento, m.MemberTelefone,
            m.MemberEscola, sexo);

        return key;
    }

Note that the record is saved both in memory and in the database. I thought about the method Tableadapter.Fill(), but using too much this method does not slow down the application?

I think about whether the value of Primary key will change if it is the same record. This could cause several problems.

  • They are objects with different purposes. The DataReader, for example, not for persistence. In which aspect I would like to compare them?

  • They are of different purposes, but the doubt is in relation to the rescue, because as you saw, I called two methods, one to save at the base and the other to save at the dataset. Using the Fill method often does not slow down the application?

  • I need you to put this part also in the body of your question.

  • Rephrased question.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.