Data-driven projects are heavily used in desktop applications, so I'm working on a library project where you save member records. I am using the 3 Layer Application method, it is very efficient and keeps the code clean. In the DataSet: I want a key ambiguity of the user both on the same, as the basis. Here is an example of the code I'm 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 TableAdapter .Fill () method, but using this method a lot does not make the application slow?
I wonder if the value of primary key will change if it is the same record. This could cause a lot of problems.