1
I recently learned a little object orientation and c#. But I am trying to create an application that is developed in c# windows Forms, with database Firebird and object-oriented. But what’s the right way to do this? How do I connect my database to my application and how do I make it interact with the visual studio interface? I’ve also seen that it is possible to use App.Config
as in the sql, but how do I do it?
For example, currently I have the repostoring of a class and within it create events like add, change and etc, usually I do so:
public void Adicionar(Pais pais)
{
string sql = "INSERT INTO PAIS (PAINOME) VALUES('" + pais.PaiNome+ ")";
Conexao.Active(true);
FbCommand cmd = new FbCommand(sql, Conexao.fbCnn);
cmd.ExecuteNonQuery();
Conexao.Active(false);
}
That way every time I make some changes in the classes I have to change in all the repositories, for example, if I add a new field to the country I would have to change in all the sql strings by adding the new field. Is this the right way to do it? I can make it more automatic or not?
Thank you!
Thanks for the tips and help!
– André Morais Martins
Give one up then, if you considered as answer ;)
– Andrew Paes
I’m new here and I don’t even know much! It was bad.
– André Morais Martins
Just click on the icon next to my answer, saying it’s the right answer. Hug
– Andrew Paes