﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Patryk Nowakowski / Article Discussions / Article Discussions by Author  / ADO.NET - A Data Access Layer / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 20 Jun 2013 02:33:53 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: ADO.NET - A Data Access Layer</title><link>http://www.sqlservercentral.com/Forums/Topic126717-183-1.aspx</link><description>&lt;P&gt;Does DAL refuse Data-Binding approach? In other words can it be used when one wants a GUI control (as opposed to developer's SQL code) to take care about SELECT / UPDATE / INSERT / DELETE?&lt;/P&gt;&lt;P&gt;I am having problems with an old application relying heavily on data binding. It needs to migrate to .NET. The database gradually became pretty ugly during its many-years lifetime.&lt;/P&gt;&lt;P&gt;I'd love to create / use a DAL approach which seems to be the only way to maintain the application's being up and running while "remodeling" is being in progress. But...&lt;/P&gt;&lt;P&gt;What about the first question in this post please?&lt;/P&gt;</description><pubDate>Wed, 03 Aug 2005 07:06:00 GMT</pubDate><dc:creator>Igor Makedon</dc:creator></item><item><title>RE: ADO.NET - A Data Access Layer</title><link>http://www.sqlservercentral.com/Forums/Topic126717-183-1.aspx</link><description>I agree with all Patryks reasons for using a data access layer.I also re-iterate rugha's comment - see the microsoft SqlHelper class which they publish separately as a freely downloadable Data Access Application Block.This allows the coder to use static methods to perform most data access tasks which makes things much easier. You can of course build on this to do logging etc...http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp</description><pubDate>Wed, 04 Aug 2004 22:11:00 GMT</pubDate><dc:creator>Renato Buda-153382</dc:creator></item><item><title>RE: ADO.NET - A Data Access Layer</title><link>http://www.sqlservercentral.com/Forums/Topic126717-183-1.aspx</link><description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;My DAL starts with Stored Procedures and prepared commands and we use .NET framework components with corresponding typed datasets. Then you can drop your DAL Component and needed datasets to Win/WebForm and call its methods. It is good idea to create typed dataset properties in your component so it will allow you to select dataset instance using IDE property editor - cheers!&lt;/P&gt;&lt;P&gt;Common DAL "framework" should be comprised of component base classes. That's how I see this problem. Btw, when you use SqlCommand object's parameters collection, "sql injection" is not a problem any more.&lt;/P&gt;&lt;P&gt;Have a nice day&lt;/P&gt;</description><pubDate>Tue, 03 Aug 2004 08:00:00 GMT</pubDate><dc:creator>Zvonko M.</dc:creator></item><item><title>RE: ADO.NET - A Data Access Layer</title><link>http://www.sqlservercentral.com/Forums/Topic126717-183-1.aspx</link><description>&lt;P&gt;The &lt;U&gt;Data Access Application Block&lt;/U&gt; is really quite excellent. This is also another opportunity to plug &lt;EM&gt;Code Generation&lt;/EM&gt;. I know, I know, I promised to write an article on the topic and I started one but it sucked &lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt; I'll get back to work on it soon.&lt;/P&gt;&lt;P&gt;My point is, you should not have to write 80% of the stored procedures or &lt;EM&gt;any&lt;/EM&gt; of the data access layer. Let a code generator do the generic stuff for you. Check out CodeSmith at &lt;A href="http://www.ericjsmith.net/codesmith/"&gt;http://www.ericjsmith.net/codesmith/&lt;/A&gt; or the Code Generation Network at &lt;A href="http://www.codegeneration.net/"&gt;http://www.codegeneration.net/&lt;/A&gt;.&lt;/P&gt;</description><pubDate>Tue, 03 Aug 2004 07:58:00 GMT</pubDate><dc:creator>Tatsu</dc:creator></item><item><title>RE: ADO.NET - A Data Access Layer</title><link>http://www.sqlservercentral.com/Forums/Topic126717-183-1.aspx</link><description>&lt;P&gt;havent read the whole article, just wanted to let you know about the "Data Access Application Block" published by microsoft for that exact purpose, it is quite easy to use, details and downloads can be found here :&lt;/P&gt;&lt;P&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;cheers &lt;/P&gt;&lt;P&gt;rugha&lt;/P&gt;</description><pubDate>Tue, 03 Aug 2004 07:25:00 GMT</pubDate><dc:creator>rugha</dc:creator></item><item><title>RE: ADO.NET - A Data Access Layer</title><link>http://www.sqlservercentral.com/Forums/Topic126717-183-1.aspx</link><description>&lt;P&gt;A few issues I see with this approach. I'm curious as to your opinion on them:&lt;/P&gt;&lt;P&gt;1) It does nothing to prevent SQL injection attacks. I can pass in something like "select * from table ; delete * from table", which would qualify as a select statement, but would execute both the select and the delete statement. Very dangerous and hard to catch.&lt;/P&gt;&lt;P&gt;2) Aren't you losing all the benefits of running stored procs by using sp_executesql? None of the queries are running against pre-compiled sprocs that way, and some queries can be very long and complex (much more than 1000 characters).&lt;/P&gt;&lt;P&gt;Again, I really like the idea of a data access layer (it's been on our development list for a while now). I'm just not sure what the best approach is for it. I prefer to require the client to access all data through stored procedures (we develop a web based app), which makes it hard to develop a generic interface.&lt;/P&gt;&lt;P&gt;Just my $0.02. I'm curious to hear what other people think.&lt;/P&gt;&lt;P&gt;Greg WalkerDBAExpenseWatch.com&lt;/P&gt;</description><pubDate>Tue, 03 Aug 2004 07:04:00 GMT</pubDate><dc:creator>Greg Walker</dc:creator></item><item><title>RE: ADO.NET - A Data Access Layer</title><link>http://www.sqlservercentral.com/Forums/Topic126717-183-1.aspx</link><description>&lt;P&gt;Razvan raises a good point, and one that reinforces the suggestion that a data layer is a good idea.  It's much easier to prevent SQL Injection and the like in a dedicated data layer, than on every individual SQL call.&lt;/P&gt;&lt;P&gt;Tony&lt;/P&gt;</description><pubDate>Tue, 03 Aug 2004 05:38:00 GMT</pubDate><dc:creator>Tony Hinkley</dc:creator></item><item><title>RE: ADO.NET - A Data Access Layer</title><link>http://www.sqlservercentral.com/Forums/Topic126717-183-1.aspx</link><description>&lt;P&gt;Patrick,&lt;/P&gt;&lt;P&gt;You wrote "we have to ensure that the SQL command passed to the procedure is actually a SELECT statement". I hope that you realize that the statement could be something like this:&lt;/P&gt;&lt;P&gt;SELECT 1 DELETE _t_spsys_select_log WHERE log_id=(SELECT MAX(log_id) FROM _t_spsys_select_log)&lt;/P&gt;&lt;P&gt;This means that we must trust the developer of the client application to give us a correct SELECT statement. This means that we trust that he only uses hard-coded strings or if he uses anything entered by the user, he validates them very well. If anyone wants to read further on this topic, see:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.nextgenss.com/papers/advanced_sql_injection.pdf"&gt;http://www.nextgenss.com/papers/advanced_sql_injection.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Razvan&lt;/P&gt;</description><pubDate>Tue, 03 Aug 2004 04:04:00 GMT</pubDate><dc:creator>Razvan Socol</dc:creator></item><item><title>ADO.NET - A Data Access Layer</title><link>http://www.sqlservercentral.com/Forums/Topic126717-183-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF=http://www.sqlservercentral.com/columnists/PNowakowski/adonetadataaccesslayer.asp&gt;http://www.sqlservercentral.com/columnists/PNowa</description><pubDate>Fri, 16 Jul 2004 11:31:00 GMT</pubDate><dc:creator>Patryk Nowakowski</dc:creator></item></channel></rss>