|
Hello,
Im doing a big final project that manages a dive shop.
This application will have data base.
What im looking for is some example of solution that works with data base(connect to DB , SQL , Query) that i can take and modify it for my needs.
Thanks.
|
|
|
|
|
I can offer you some insight into creating a Data Access Layer.
DatabaseAccessor[^]
There are many similar articles on here.
|
|
|
|
|
I understand that article is from 2007, but I'd completely disregard it. It was completely bad practice even "back then". Definitely is horrible practice today. Use a proper data access layer like EF, nHibernate, etc. At the very least, if you use barebones ADO.NET, you should not write queries in the C# code like that. Completely vulnerable to a script kiddie who knows SQL injection.
|
|
|
|
|
SledgeHammer01 wrote: Completely vulnerable to a script kiddie who knows SQL injection
Bullshit -- it fully and easily supports parameters so there's no reason a developer has to leave himself open to that.
SledgeHammer01 wrote: EF, nHibernate, etc
And what do you think they do in the background? Exactly the same things I do. Everything has to go through a command and connection eventually; I cut out the middle man. Additionally, those tools may not support whatever database the OP has to use, whereas there is probably an ADO.net connector for it.
|
|
|
|
|
SledgeHammer01 wrote: It was completely bad practice even "back then".
Nonsense.
SledgeHammer01 wrote: you should not write queries in the C# code like that. Completely vulnerable to a script kiddie who knows SQL injection.
You and I must have completely different definitions of SQL injection then.
I don't see anything in there that suggests anything at all like that.
|
|
|
|
|
Most of the ORM providers are bult upon ADO.NET.
but personally I dont think there is anything wrong with using ADO.NET, SQL Injection is only possible when there is a lack of parameterised queries.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Just do a search in the articles section on this site.
There are a number of good samples and articles here.
|
|
|
|