Hitchhiker's Guide to Visual Studio and SQL Server, 7th Edition: Best Practice Architectures andExamples By R.. The 7th edition is unique in that it's designed to provide not only up-to-
Trang 1Hitchhiker's Guide to Visual Studio and SQL Server, 7th Edition: Best Practice Architectures and
Examples
By R Vaughn William, Peter Blackburn
Publisher: Addison Wesley Professional Pub Date: November 02, 2006
Print ISBN-10: 0-321-24362-5 Print ISBN-13: 978-0-321-24362-1 Pages: 1128
Table of Contents | Index
Since 1994 when he wrote his first "Hitchhiker's Guide", William Vaughn has been
providing developers all over the world the intimate details of how SQL Server can be accessed and managed from RAD languages like Visual Basic and Visual Basic NET With the 7th Edition, Bill has completely rewritten this encyclopedic work from cover to
covergiving readers his insightful views on how applications should be built to maximize both developer and code performance Visual Studio and the languages it hosts have never been as sophisticated as they are todaythe same can be said for SQL Server This makes it even more important for developers to understand how to best leverage their features without being held back by their complexity That's what this book is all
aboutmaking it easier for developers regardless of their know-how.
The 7th edition is unique in that it's designed to provide not only up-to-date tutorials on the latest development tools provided by Visual Studio and SQL Server, but also a solid platform of architectural advice and rich examples for developers trying to choose between the myriad of platform options Beginners and experts alike will find comprehensive step- by-step instructions that can make the reader's introduction to the latest versions of Visual Studio and SQL Server far easier.
Key topic coverage includes:
• Data access architectures and how to choose the best strategy for Windows Forms, ASP.NET, XML Web Services, and SQL Server CLR executables Where
do these make sense and how much will they cost to build and maintain?
• SQL Server and relational database fundamentals and inner-machinery.
How does SQL Server work and why is it important that developers know?
• Making the development experience more productive through judicious use of the Visual Studio toolset, and how to know when the wizards can help.
Trang 2conferences all over the world where his wit and no-holds-barred technical insights win him rave reviews William is also a member of the prestigious INETA Speaker's Bureau His works include articles for SQL Server Magazine and a bi-weekly editorial for Processor Magazine as well as books published by Microsoft Press and Apress.
The book includes a DVD that contains a wealth of examples as well as several sample databases used to illustrate points discussed in the book Authenticated readers will also have unrestricted access to the book's supporting web site, www.hitchhikerguides.net, where additional examples, online forums, and other supplementary materials are
Trang 3Hitchhiker's Guide to Visual Studio and SQL Server, 7th Edition: Best Practice Architectures and
Examples
By R Vaughn William, Peter Blackburn
Publisher: Addison Wesley Professional Pub Date: November 02, 2006
Print ISBN-10: 0-321-24362-5 Print ISBN-13: 978-0-321-24362-1 Pages: 1128
Trang 9Many of the designations used by manufacturers and sellers todistinguish their products are claimed as trademarks Wherethose designations appear in this book, and the publisher wasaware of a trademark claim, the designations have been printedwith initial capital letters or in all capitals
The authors and publisher have taken care in the preparation ofthis book, but make no expressed or implied warranty of anykind and assume no responsibility for errors or omissions Noliability is assumed for incidental or consequential damages inconnection with or arising out of the use of the information orprograms contained herein
The publisher offers excellent discounts on this book when
ordered in quantity for bulk purchases or special sales, whichmay include electronic versions and/or custom covers and
content particular to your business, training goals, marketingfocus, and branding interests For more information, please
Trang 10Hitchhiker's guide to Visual studio and SQL server : best practice architectures and examples / William R.Vaughn, Peter Blackburn.
Trang 11commercially available code This series should be an invaluableresource for any IT professional or student working in today'sWindows environment
Trang 13In 1992, Microsoft first launched Microsoft Access Version 1.0 as
a competitor for FoxPro (which it bought), Btrieve, Paradox,PowerBuilder, and DBASE Many think that this was Microsoft'sfirst foray into the world of database engines It wasn'tMicrosoftintroduced its first DBMS system in 1988 when it joined withSybase and Ashton-Tate to launch its own version of SQL
developers at all skill levels to create data access applicationsthat leverage SQL Server's power, scalability, and flexibility
I joined Microsoft in 1988 where I had the pleasure of serving
as the first program manager for SQL Server Our teams workedwith Sybase early on and eventually helped create the OpenDatabase Connectivity (ODBC) standard Later in my career, wehelped bring together the Visual Studio family of developer
tools and drive the Win32 API, customer requirements, and
Trang 14Microsoft and most recently have taken on the responsibility ofSenior Vice President of the Server and Tools business unit thatencompasses both SQL Server and the development languages
During these years, we all witnessed SQL Server's market sharegrow steadily from an "all other" slice to over 50% market
share and Visual Basic grow to be the most popular language onthe planet However, one problem Microsoft faced throughoutthis evolutionary period was documentation, training, and user-education Since the SQL Server documentation team focusedits attention primarily on SQL Server, and the Visual Studio UserEducation team focused primarily on user interface, tools, localdata, and language issues, a gap was created that only
someone familiar with both disciplines could tackle
From the very earliest versions of SQL Server, while working forMicrosoft University, Bill Vaughn wrote SQL Server courseware,managed and mentored SQL Server trainers, and wrote booksand articles This entire body of work was focused on helpingdevelopers understand how SQL Server and development
languages like Visual Basic and Visual Basic NET can be used tobest leverage the power of SQL Server His efforts to tie SQLServer and Visual Basic together were continued while he
worked for the Visual Basic user education team and since
retired from Microsoft in 2000 I first met Bill in 1988, and hewas often a thorn in my team's side as he lobbied for more
emphasis on SQL Server and IT data issues and better access
to SQL Server's sophisticated features It was clear that Bill wasnot afraid to express his opinions on how the languages andtools should be adapted to handle what he called "IT data." Iguess this is because Bill had worked predominantly with verylarge databases at Electronic Data Systems and earlier in his34-year career Since Bill came in contact with so many IT
developers while at MSU, many of his ideas were tempered withreal-world field experiences offered by his students and
Trang 15he lets us know through his books and articles Clearly, Bill is anindependent thinker, and while he certainly knows and endorsesMicrosoft technology, he's quick to point out what works, whatdoesn't, and how developers can work around the issues
Over the last 22 years, Bill has contributed a significant amount
of quality data access documentation and training His effortshave also yielded (now) seven editions of his well-respectedHitchhiker's Guides, as well as three additional ADO and
ADO.NET booksmany of which have been translated into nearly
a dozen languages Developers all over the world have learned
to depend on and respect his vast body of work
This most recent book has been a monumental effort for Bill.Working almost three years on this edition, Bill has drawn onmany respected industry sources as well as many of my teammembers here at Microsoft He's attended and actively
participated in any number of professional conferences and
been invited to our own Microsoft software design reviews
where Program Managers gather feedback and suggestions
from industry experts His input was invariably on-target for thedeveloper community he represents
We're extremely excited by the success of NET and, with 2.0,the opportunity for Visual Studio continues One of the reasons
I can heartily endorse Bill's latest book is that it simply makes iteasier for developers at all skill levels to get up to speed quickly
Trang 17Peter Blackburn
I've now known Peter for many years During that time, he'sbeen my technical rock He keeps me on track in any number ofareasselflessly providing his time and expertise whenever andwherever he can He's a close friend, far beyond being a
of the uglier aspects of Visual Studio and SQL Serverlike C# and(ugh) XML Peter, thanks
Microsoft Development Teams
I was very privileged throughout the writing of this book to
have a direct access to key members of the development teams
at Microsoft Yes, some of this access is due to my status as aMicrosoft MVP, but some of it is because I consider many of
these people friendsI've worked with them for many years
before and after my "retirement." In some ways, this
relationship has been symbioticas I point out issues, the teameither tells me they'll fix it, they show me why it's not an issue,
or they put it on the stack of issues to fix one day I've seenthis interaction result in better products and certainly enabled
Trang 18otherwise be possible
Sahil Malik, Winsmarts author, trainer, and consultant
Steve Lasker, Microsoft PM/Technical Lead for the UiFX and Services Team Brian Randall, MCW Technologies Sr consultant
Trang 19Victoria Ballard (George) and Chrissy Vaughn (Fred)
Ladies, you are my finest achievement Since you have yourown lives, you can't take the time to review or copyedit or makesure I'm not offending the people in some small town or majorcountry anymore But the lessons you've taught me over thelast few decades are sewn into the fabric of all I write I am
very proud of both of you Thanks
Trang 20WILLIAM R VAUGHN has worked in the computer industry
since 1972 He holds a Bachelor's degree in Computer Sciencefrom Mary Hardin-Baylor and a Master's degree in
Interdisciplinary Studies from the University of Texas He's alsobeen awarded an Honorary PhD from the University of
Advancing Computer Technology in Tempe Arizona Bill spenthis early years working in the mainframe data processing
industry and transitioned to the personal computer side in thelate 70s Along the way, he worked for the Texas DPS NarcoticsService, EDS (where he was recruited by and worked for RossPerot), at Mostek/United Technologies, Challenge Systems,Digital Research, and CPT Corporation After having surfed the
PC industry for many years, he began his Microsoft years in
1986 working for the Windows developer liaison team at
Microsoft in 1986 For the next 14 years, he worked in variousdivisions at Microsoft including Microsoft University, the VisualBasic documentation and Visual Studio marketing and InternalTechnical Education teams before retiring in 2000 to form hisown company, Beta V Corporation Bill has written seven
editions of the popular Hitchhiker's Guide (the 4th, 5th and 6th
published by Microsoft Press) and books for APress, including
the bestseller ADO and ADO.NET Examples and Best Practices Peter Blackburn and Bill also coauthored the Hitchhiker's Guide
to SQL Server 2000 Reporting Services (Addison-Wesley) His
latest work is Hitchhiker's Guide to SQL Server Everywherehis first e-Book He writes lead articles for SQL Server Magazine where he is a contributing editor, MSDN, and others Bill also writes a bi-weekly editorial for Processor.COM magazine Bill is
a top-rated speaker at conferences worldwide, including
keynotes and sessions at TechEd, DevWeek, Dev Connections,SQL Connections, VBUG, and many others He is a MicrosoftMVP and a member of the INETA Speaker's Bureau
Trang 21since 1981 He studied computer science at Cambridge
University, England from where he holds an M.A degree
Through his consulting company, Boost Data Limited, Peter hasdesigned, built, and implemented small- and large-scale
database systems including reporting systems based on SQLServer He has contributed countless hours to the developmentand honing of Microsoft Reporting Services and remains directlyinvolved with the development team He is also a Microsoft MVP
He supports developers through newsgroups and beta
programs, and trains teams of developers working with SQLServer and Reporting Services Having worked closely with NETsince before the launch, Peter and Boost Data have ensured thetechnical accuracy of many leading NET books Peter lives inthe United Kingdom and travels all over the world to consult,speak, and provide support for his fellow developers, fellow
MVPs, his writing team, and Microsoft itself
Trang 22introduction from the sixth edition observed that a lot of
important changes had been made since the previous
editionsignificant changes to Visual Basic, ADO, SQL Server, andthe tools and techniques to connect them I didn't think that thetechnology could change much more radically than introducing
a fully compiled Visual Basic and a new version of a fairly
sophisticated data access interface (COM-based ADO) to drive
it I was wrong
Today, given the current state of SQL Server and what Microsoftcalls "Visual Basic," saying that a lot has changed over the lastseven years would be a gross understatement Just before Iretired from Microsoft in 2000, Microsoft walked away from itsCOM-based version of Visual Basic (6.0) as it introduced its
successor: Visual Basic NET built on the new NET
Frameworkthe foundation for Vista At the time, it was clearthat these changes would require a cover-to-cover rewrite of
Trang 23Along the way, Peter Blackburn came on board and was
instrumental in getting these two Apress books to market andsubsequently convinced me to write a more focused book on hisfavorite topicSQL Server Reporting Services Since the next
version of Visual Studio (Whidbey) was not due for another
year, it seemed like a good idea (at the time) This project wasexpected to generate a 200-page book in about three months
In actuality, it took over a year to grind out, but Hitchhiker's
Guide to SQL Server 2000 Reporting Services (Addison-Wesley)
is a 780-page tome that's the most respected book on SQL
Server Reporting Services yet published Peter did the bulk ofthe research and initial writing, and provided significant (andgreatly appreciated) technical guidance and logistical supportfor the seventh edition
Trang 24
What's so special about the Hitchhiker's Guide series? Well,
perhaps a bit more history will help clear this up In the late1980s, I worked for Microsoft University (MSU) writing and
delivering courseware on any number of now-obsolete technicalsubjects like OS/2 and Quick Basic When Microsoft established
a partnership with Sybase to co-market and develop an OS/2version of SQL Server, MSU and I were recruited to build
courses to teach developers relational database design, TSQLprogramming, DBLibrary programming, and other related
subjects I managed and contributed courseware to the group
of trainers who wrote and delivered this courseware for almostfive yearsoften three to five days a week, three weeks a month.Along the way, we all learned a great deal about SQL Serverand best practices
techniques were drawn from the courseware I had written and
my interaction with SQL Server developers and MSU students.Using some pretty silly and irreverent examples and prose, Iwas able to make a fairly dry topic humorous and very
Trang 25Each subsequent edition of the Hitchhiker's Guide leveraged the
previous as I expanded my understanding of Visual Basic andSQL Server and as these products evolved and matured Eachedition focused on the latest Visual Basic and SQL Server
interfaces and features, and each became the definitive sourcefor information on ODBC, DAO, ODBC Direct, ADO, and the
Visual Basic tools used to access these data access interfaces Ilike to think that the book itself helped focus Microsoft and thedata access teams on addressing many real-world issues that
my students, customers, and readers constantly relayed to me
As I created new solutions to common problems, I would foldthese into the next edition Over the years, I've spent
considerable time interacting with the developer communityatconferences, via newsgroups, and in training sessions If you'vemet me and made a good suggestion for a better way to handle
a data access issue, it has probably ended up in the book
somewhere
Eventually, Hitchhiker's Guide's popularity encouraged Microsoft
Press to ask to publish the fourth edition After we came to anunderstandingI would maintain full editorial control (the jokesand Microsoft barbs had to stay)I relented and the soylent-
green fourth edition was published Microsoft Press
subsequently published the updated fifth and sixth editions overthe next few years; it was subsequently translated into at leasteight languages, including Japanese, Spanish, French, German,Hungarian, Italian, Korean, and Chinese
Trang 26
The Hitchhiker's Guide to Visual Studio and SQL Server, 7th
Edition, is intended to provide a broad treatment of Visual
Studio and SQL Server, how they interact, and how developerscan build professional applications using these tools and
documentation team, I was "permitted" to document Visual
Basic but not SQL Serverthe documentation had to be "generic"
and apply equally to all database backends All of my bookshave filled this gap between the language (Visual Basic) and thevarious versions of SQL Server
The seventh edition of the Hitchhiker's Guide takes an even
broader view of data access development when compared toprevious editions That's because Visual Basic NET is not theVisual Basic language discussed in the earlier editionsthus the
change in the title to Hitchhiker's Guide to Visual Studio and
SQL Server Today, RAD development is as much about Visual
Studio as it is about the development language That's becauseVisual Studio generates a significant amount of code in the
selected language and provides so many tools, wizards,
controls, classes, and interfaces that are common to all of thelanguages it hosts As a result, the 7th edition spends
considerable time discussing how the Visual Studio toolset can
be, should be, and should not be used to create professionalapplications
SQL Server has also introduced an entirely new paradigm
Server-side executables can now be written in Visual Basic NET
Trang 27
I spend a long time discussing how and when it makes sense todesign and implement each of thesewell beyond the scope of
previous editions of the Hitchhiker's Guide You'll find the entire
book is focused on connecting to and running queries on SQLServernot Oracle, DB2, or JET Sure, developers who need toaccess other DBMS platforms have praised my previous booksbecause the fundamental principles and best practices I
describe often (usually) apply to other DBMS platforms as well
In any case, I don't want to dissuade developers from buyingthe book just because "Visual Basic" or "C#" is on the cover;
99.44% of the book's content applies equally to C# and Visual
Basic NET, although most of the examples are provided in
Visual Basic NET I had originally planned to provide parallel C#examples in addition to Visual Basic NET, but I ran out of timeand bandwidth I expect most C# developers can easily
translate Visual Basic NET code to C# But the same can't besaid for a portion of Visual Basic NET developersespecially
those transitioning from Visual Basic 6.0 I also did not include
a SQL Server version number in the title, as the discussionsapply to any post-SQL Server 2000 version, including SQL
Server 2005 and its service packs Given Microsoft's stated
intent to update its products every year or after every lawsuit, Ineeded to do what I could to keep the title (and content) fromgetting stale before its time
Trang 28
In all of my books, I've tried to provide up-to-the-moment
information, but this is really a daunting task, as Microsoft isconstantly updating, fixing, and tuning the released products.It's as if they don't really have a long-term plan of how we'resupposed to write our applications What's perfectly suitabletoday is passé, discouraged or dropped, or hidden or
deprecated tomorrow I don't see an end to this constant cycle
of early release, repair, and planned obsolescence as Microsoftattempts to maximize their profits by forcing development
shops (and users) to buy their latest whiz-bang versions It
seems there is never enough time to build a product that
include the features ordinary developers need and (sadly) neverenough time to fix it once it ships
As an author, I'm also faced with a dilemma At this point intime (April 2006), I have over 750 pages of original contentsitting on my hard-drive I can't show it to anyone until the
book gets into print Given that the useful lifetime of technicalcontent is approaching the duration of a phosphorus flashbulb,
we (the publishers and I) have to figure out a new way to getcurrent content into your hands more quickly The other
problem I'm faced with is scope Frankly, I would have liked toinclude far more in-depth information on many other relatedsubjects, like ASP development issues, security, deployment,SQL Trace, the profiler, and others I would also like to discussthe new DLINQ and other emerging (and experimental) dataaccess technologies to be released with the next version of
Visual Studio (Orcas) I found that this was simply impossible toaccomplish when working virtually alone
To address these problems, I'm planning to write and publish(one way or another) a set of EBooks on related subjectsyou'llsee references to these as you read Ironically, the first EBookmight be available before the first printed copiesit seems to
Trang 29nowadaystime enough for Microsoft to reinvent the entire toolssuite EBooks are generally shorter than paper books (Addison-Wesley even calls them "shorts")usually just a single chapter orsectionso they are far easier to write, edit, and distribute
Unlike paper books, EBooks can also contain full-color
illustrations and provide links to online animations, Camtasiavideos, or other supplementary content
Paper-based book and magazine publishers are trying to figureout how to best market and sell EBooks, but it remains to beseen if they have the vision and courage to transition away fromtheir traditional printing and distribution paradigms The
problem we all face with EBooks is piracy All too often, as soon
as an EBook is published, those who would cheat the systemput the content on the Internet This robs authors and
publishers of their motivation to publish, and everyone suffers
as a result Several months' work can be flushed away in aninstant Until this problem is solved, I don't expect many
publishers will fully explore this unchartered territory I'm going
to experiment with a few EBooks to see how well they are
received and whether the rumors about piracy are true My firstwill be on SQL Server Everywhereif it's still called that by thetime you read this
Trang 30I'm often asked if my books are a good match for the skills andinterests, and needs and focus of one group of developers oranother While I would like to say, "It's for anyone who can
read," that's not really true, as you might expect I can say thebook is for:
Software developers, architects, and their managers whospecify, design, code, assemble, test, deploy, support,
update, and live with business applications that managedataespecially SQL Server data
Developers with some experience in Visual Basic 6.0, VisualBasic NET, or C#; or those developers skilled in other
languages who want to understand these languages andhow to use them to create data access applications
Anyone who wants to leverage the latest and ever-evolvingVisual Studio and SQL Server feature setlearning what
works, what doesn't, and why
Consultants and mentors who want to learn how to bestsupport their SQL Server customers by creating quick
applications more quickly
Those who want to try to learn how to best use SQL Serverfor the first time, as well as those who have experience withSQL Server and its versions and variations
Any of the previously mentioned people who wants to knowhow and (more importantly) when to leverage the powerand potential of SQL Server 2005 CLR executables or SQL
Server Reporting Services through the new Report Viewer
Trang 31Students, teachers, trainers, and courseware designers whowant to gain or pass on useful skills to be competitive in thesoftware-development business
It's written so I can simply point to a place where anyoneanywhere on the planet can get another point of view onhow to develop data access applications using Visual Studioand SQL Server
It's also written for me It's my way of passing on what I'velearned by experience and from my readers, my sessionattendees, and those folks whose questions I've answeredover the years
It's also for Alberta Lee, my 81-year-old mother-in-law, asshe puts a copy of the book on the mantel to show her
friends
Trang 32
Look for links to my EBooks on the seventh edition's supportwebsite: www.hitchhikerguides.net A six-month paid
subscription to this site is included with the price of this book.All I ask is that you register with the site using the "scratch-and-sniff" number found just inside the front cover of the book.This, along with a valid email address, will permit you to gainaccess to the "premium content" area that includes updates,errata, and reduced-cost access to my growing number of
EBook offerings, as well as the ability to participate in the
reader's forum section of the site I encourage you to use thesite to provide feedback, ideas for other content, and supportfor other readers I hope this helps
William R Vaughn
President, Beta V Corporation
Trang 33Chapter 1 Exploring Application Architectures
Trang 34A professor at MIT is quoted as saying, "Design is what you dowhen you don't [yet] know what you are doing."[1] This is verytrueeven for application architects It seems that so many of usdepend on the wisdom of others to design their systems that
we fail to learn the fundamentals of system design As a result,the end product can scale, run efficiently, and be maintained fordecades to comecome what may
SQL, and knew how to build a normalized relational database.Since then, I've seen too many questions that could be simplyanswered by a better understanding of those fundamental
understanding of how SQL Server works, knew how to write T-tenants To make it easier for you to understand why one
architecture or technique is suggested over another, let's start
by providing some foundational material that should help makeyour choice of architecture and how you build your applicationseasier Of course, if you think that you're up to speed on all ofthese issues, feel free to skip on down
Trang 35[3] I've written at least 11 booksnot counting the volumes I wrote for Microsoft and other companies over the years.
Trang 36When presented with an application challenge, we often have tochoose a workable approach from myriad alternatives to
implement the design As when building a new house, the
choices you make determine how well it holds up and meetsyour customer's or your personal needs when it's used or
abused, or when a hurricane blows through Your design andimplementation (the way you build your house) also determinehow easily you can add a new wing or simply remodel the
kitchen Your design and implementation also determine
whether or not the building inspector will approve your homefor occupancy or force you to go back and add bathrooms Yes,there are always constraints Just as building codes, the
homebuilder's budget, and the site chosen dictate what kind ofhouse you build, software architects and developers are limited
as to budget, schedule, integration with existing applications,databases or operating systems, and what the boss's nephewthinks the program should do Experience tells us that "people"issues often play a pivotal role in the choice of architecture Asarchitects, mentors, and consultants, we all must concern
ourselves with training (or retraining), installation and
deployment, and licensing costs (assuming your company
actually pays for its software), as well as myriad developmentissues We've all seen situations where the company was dead-set against one or more architectures long before we arrivedand no amount of logic would shake them from this opinion.Perhaps, the company has built their system up over severaldecades and, due to its immensity, can't possibly change it.While these situations are not always dire, they can significantlyimpact the success of your working relationship and your ability
to provide a "best practice" solution
Sometimes (fairly often, in my experience), you'll be called on
to modify, repair, or resurrect an existing applicationperhaps
Trang 37design that you can't endorse Perhaps the company is lookingfor validation for an architectural approach or some way to
provide independent credibility for a decision made about theapplication
Office politics is another factor that often plays a big role in
some-odd years it's that people are very sensitive about theircreative ideas Criticizing their design is tantamount to sayingtheir kid's face resembles a pig's butt (even though it does).They also tend to be defensive about designs sold to upper
application design If I've learned anything over the last thirty-management or suggested by someone they respect If the
design fails or is somehow flawed, someone's career might be
in jeopardy When you approach an existing design, considerwho created it, its history, and the motivation behind that
approach before you add your offhand or well-considered
comments
IMHO
Criticizing a customer's design is like telling them their kid'sface resembles a pig's butt
I lost count of the number of times someone has asked about aproblem with their application only to tell us that they didn'treally have a choice as to a better (best practice) alternativeit'snot their design I expect many of you have worked with
customers who tell you how to design the system down to thefinest detail but blame you when it does not work as they
expected Doctors have the same problem when a patient who'sbeen watching the 6 PM news decides that they have every
disease the pill-pushers are advertising It's hard to know what
to do in these casesthere is no simple answer Do we tell our
Trang 38"challenged," or do we carefully outline specific problems andareas of concern? We could just walk away and lose the account
to someone who needs the job or doesn't know better
My approach has been to try to prevent these problems in thefirst place by mentoring the customer as the specification iswritten and work with their team to better understand the
issues, challenges, and dependencies before the design is set instone If I arrive on the scene too late or they insist on a
challenged design, I insist on documenting our concerns andeither walk away or do the best I can given the constraints
Frankly, sometimes it's best for everyone if I turn down projectswith a doomed design It's like trying to repair an engine thatmelted down to a puddle trying to deliver 5 tons of bricks with a
¼-ton Toyota pickup Sometimes, it's cheaper and easier (in thelong run) to get a new truck that's better designed for the load
As we've all seen, even the most prestigious leaders have
trouble knowing when they're in over their head and admittingthey made a mistake in judgment
On the other hand, perhaps our skills are not a good match forthe project Consider this: When surgeons approach a patient'sproblem, they try to solve it with a scalpel because that's thetool they know best When chiropractors approach the sameproblem, they try to solve it with an "adjustment," just as apodiatrist would use a lift or an orthopedic shoe In the sameway, when a programmer that's worked exclusively with
JET/Access databases approaches a problem, they're likely todesign the solution with JETeven though it's rarely the best fit
In the same way, ASP developers tend to choose browser-basedsolutions just as Windows Forms developers tend to choose aclient/server approach Unfortunately, too many developers
choose an approach because it's new or sexy or has "XML" inthe name instead of the approach that best fits their customer'srequirements In our world of specialization, consultants anddevelopers often have to know when their skills and specialties
Trang 39encounter problems that can't be solved with your skillset, youneed to get more training, do more research to add more skillsand talents to your toolbox, refer the problem to a specialistorknow when to back away I assume that's why some of you arereading this book
Trang 40
Today, ADO.NET is the mechanism applications of all
kindsregardless of their architectureuse to communicate withSQL Server Yes, because Visual Studio generates much of thiscode for you (if you choose that route), the low-level ADO.NETcommands are often hidden from view like the gears in yourcar's transmission ADO.NET is certainly one of your most
frequently used data access development tools I'm convincedthat if you don't know ADO.NET and how it works, your ability
to design and build successful, long-lasting, and well-performing applications will be very limited By leveraging itsfeatures and avoiding its limitations, one can more easily buildthese successful applications ADO.NET is not new It was notinvented overnight (as some of the early SQL Server data
access interfaces appeared to be) Its sophistication and
functionality lie in not just what it does, but what it no longerdoes Since many of you are coming to this book from COM-based ADO (what I call ADO classic, or ADOc), its important toknow how we (you and I) got to this point
A Brief History of ADO and ADO.NET
In the early days of SQL Server (when Ashton-Tate sold aboutfour copies of SQL Server 1.0 circa 1989), the only way to write
a program to access the server was to write a C program thatused DB-Library (DBLib)SQL Server's first data access
interfaceit can still be used today, but with considerable
difficulty SQL Server 2005 won't expose anything but basicfunctionality when accessed with DBLib That's because
Microsoft has not really kept it updated They want you to usetheir new object-based interfaces and steer clear of low-levelAPI-based function calls