Im building some project now that I know that I will use lots of INSERT INTO queries in SQL.
So I have different classes for them, and I want to make it as much as flexible that I can.
I have 1 class with all the queries, and the second one deals with all the connection (open, close, and SqlCommand stuff…
The thing is, that I could have for example only one “command.Parameter.AddWithValue“, and I can have multiple lines like that. with different types of values (int, string etc..) and different names and meanings.
Does anyone have an idea how to encouter this pickle?
Thanks!
SQL statements have to be specific to the schema you’re querying. That includes
INSERT INTO....If you don’t want to write repetitive CRUD (Create, Read, Update, Delete) you should consider using an ORM. These are used to map your objects to SQL statements, and in the process they generate those SQL statements for you. Two more popular examples for .NET are NHibernate and Entity Framework.