Tải bản đầy đủ (.pdf) (1,688 trang)

2006 AW hitchhikers guide to visual studio and SQL serv

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (37.43 MB, 1,688 trang )

Hitchhiker'sGuidetoVisualStudioandSQLServer,
7thEdition:BestPracticeArchitecturesand
Examples
ByR.VaughnWilliam,PeterBlackburn
...............................................
Publisher:AddisonWesleyProfessional
PubDate:November02,2006
PrintISBN-10:0-321-24362-5
PrintISBN-13:978-0-321-24362-1
Pages:1128

TableofContents|Index

Since1994whenhewrotehisfirst"Hitchhiker'sGuide",WilliamVaughnhasbeen
providingdevelopersallovertheworldtheintimatedetailsofhowSQLServercanbe
accessedandmanagedfromRADlanguageslikeVisualBasicandVisualBasic.NET.With
the7thEdition,Billhascompletelyrewrittenthisencyclopedicworkfromcoverto
covergivingreadershisinsightfulviewsonhowapplicationsshouldbebuilttomaximize
bothdeveloperandcodeperformance.VisualStudioandthelanguagesithostshave
neverbeenassophisticatedastheyaretodaythesamecanbesaidforSQLServer.This
makesitevenmoreimportantfordeveloperstounderstandhowtobestleveragetheir
featureswithoutbeingheldbackbytheircomplexity.That'swhatthisbookisall
aboutmakingiteasierfordevelopersregardlessoftheirknow-how.
The7theditionisuniqueinthatit'sdesignedtoprovidenotonlyup-to-datetutorialson
thelatestdevelopmenttoolsprovidedbyVisualStudioandSQLServer,butalsoasolid
platformofarchitecturaladviceandrichexamplesfordeveloperstryingtochoosebetween
themyriadofplatformoptions.Beginnersandexpertsalikewillfindcomprehensivestepby-stepinstructionsthatcanmakethereader'sintroductiontothelatestversionsofVisual
StudioandSQLServerfareasier.
Keytopiccoverageincludes:
•DataaccessarchitecturesandhowtochoosethebeststrategyforWindowsForms,
ASP.NET,XMLWebServices,andSQLServerCLRexecutables.Where


dothesemakesenseandhowmuchwilltheycosttobuildandmaintain?
•SQLServerandrelationaldatabasefundamentalsandinner-machinery.
HowdoesSQLServerworkandwhyisitimportantthatdevelopersknow?
•MakingthedevelopmentexperiencemoreproductivethroughjudicioususeoftheVisual
Studiotoolset,andhowtoknowwhenthewizardscanhelp.


•UsingthelatestADO.NETdataproviderefficientlyandsafely.
•Howtoprotectthesecurityofyourdatabaseandyourjobbyavoidingcommonmistakes.
•Howtobuildsecure,efficient,scalableapplicationsinlesstimewithfewerresourceshow
tocreatefastercodefaster.
•HowtoleveragethepotentialofSQLServerCLRexecutablesandknowing
whenthesefeaturesmakesense.
•HowtoworkwithyourDBAtomaintaindatabaseintegrityandsecurity.
•WorkingwiththenewVisualStudioreportcontrolstoexposeyour
organization'sdatasafelyandeasilywithorwithoutleveragingexisting
SQLServerReportingServicestechnology.
WilliamR.VaughnisthePresidentofBetaVCorporationandaMicrosoftMVP.In2000
heretiredfromMicrosoftafter14yearstofocusonmentoring,speaking,andwriting.His
specialtyisdataaccessapplicationdesignespeciallywhenconnectingtoSQLServerover
theyearshe'swritten12booksonthesubject.He'sapopularspeakerattechnical
conferencesallovertheworldwherehiswitandno-holds-barredtechnicalinsightswin
himravereviews.WilliamisalsoamemberoftheprestigiousINETASpeaker'sBureau.His
worksincludearticlesforSQLServerMagazineandabi-weeklyeditorialforProcessor
MagazineaswellasbookspublishedbyMicrosoftPressandApress.
ThebookincludesaDVDthatcontainsawealthofexamplesaswellasseveralsample
databasesusedtoillustratepointsdiscussedinthebook.Authenticatedreaderswillalso
haveunrestrictedaccesstothebook'ssupportingwebsite,www.hitchhikerguides.net,
whereadditionalexamples,onlineforums,andothersupplementarymaterialsare
available.

www.awprofessional.com/msserverseries
www.hitchhikerguides.net
www.betav.com/blogs/billva
www.betav.com


Hitchhiker'sGuidetoVisualStudioandSQLServer,
7thEdition:BestPracticeArchitecturesand
Examples
ByR.VaughnWilliam,PeterBlackburn
...............................................
Publisher:AddisonWesleyProfessional
PubDate:November02,2006
PrintISBN-10:0-321-24362-5
PrintISBN-13:978-0-321-24362-1
Pages:1128

TableofContents|Index






































Copyright
MicrosoftWindowsServerSystemSeries
Foreword
Acknowledgments
AbouttheAuthors

Introduction
HowDidIGettoThisPoint?
The7thEdition'sScope
KeepingCurrent
IsThisBookWrittenForYou?
GettingHelpandSupport
Chapter1.ExploringApplicationArchitectures
Introduction
Choosingthe"Right"Architecture
UnderstandingYourToolset
RecognizingApplicationDesignConstraints
ChoosingtheRightDataAccessInterface
ChoosingtheRightDatabaseManagementSystem
UnderstandingBasicDataAccessArchitectures
Summary
Chapter2.HowDoesSQLServerWork?


















































































Introduction
ServersandVersions
InstallingSQLServer
RunningSQLServerServices
TouringtheSQLServerSystemDatabases
UnderstandingtheSQLServerSecuritySystem
ManagingSQLServerConnections
UsingtheSQLQueryTools
CreatingSELECTQueries
CreatingandQueryingViews
ImplementingBusinessRules
User-Defined(Aliased)Types
ImplementingConstraints
ManagingDatabasesandQuerieswithBatchesandScripts
TheQueryOptimizerandtheQueryPlan
UnderstandingtheBufferCache
ExecutingActionCommands
IntroducingStoredProcedures
IntroducingTriggers
UsingTransactionstoProtectDataIntegrity
AdministrativeFunctions
WorkingwiththeTransactionLog
Summary
Chapter3.RelationalDatabases101
Introduction

GettingStartedwithSolidDatabaseDesign
UnderstandingRelationalDatabaseNormalization
CreatingTables,Rows,andColumns
Summary
Chapter4.GettingStartedwithVisualStudio
Introduction
HowIGotHere
Installingthe"Right"VersionofVisualStudio
LaunchingVisualStudio
CustomizingVisualStudio2005
ConfiguringServer(orDatabase)Explorers
CreatingandManagingDatabaseConnections
ManagingDatabaseObjectswiththeServerExplorer
ManagingQuerieswiththeQueryDesigner


















































































UsingtheServerExplorertoViewSynonyms
UsingtheServerExplorertoManageTypes
UsingtheServerExplorertoManageAssemblies
UsingtheServerExplorertoManageServers
Summary
Chapter5.ManagingExecutableswiththeServerExplorer
Introduction
CreatingandEditingStoredProcedures
CreatingNewStoredProcedures
ExecutingT-SQLwithRunSelection
DebuggingStoredProcedures
DebuggingStoredProceduresonRemoteInstances
DebuggingStoredProceduresfromCode
UsingtheServerExplorertoManageFunctions
Summary
Chapter6.BuildingDataSources,DataSets,andTableAdapters
WhyCreateYADAI?
IsStronglyTypedDataImportant?
WhatIsaDataSource?
WhatIsaTableAdapter?
What'sMissingintheTableAdapter?
CreatingDatabase-BasedDataSources
ConfiguringaTableAdapter
BindingtotheTableAdapterUsingDragandDrop
UsingaTableAdapterDirectlyWithoutDrag-and-Drop?
ManagingDataTableClassesintheDataSourceDesigner
MovingDataSourcesBetweenApplications

CreatingWebServiceDataSources
Summary
Chapter7.ManagingDataToolsandDataBinding
Introduction
TouringtheVisualStudioToolbox
UsingtheDataSetToolboxElement
IntroductiontoDataBinding
UsingtheBindingSourceClass
UsingtheBindingNavigatorControl
UsingtheDataGridViewControl
UsingtheProgressBarControl
Summary











































Chapter8.GettingStartedwithADO.NET






































Introduction
ApproachingDataAccessChallenges
ADO.NETfrom50,000Feet
UsingtheVisualStudioObjectBrowsertoExploreADO.NET
InstantiatingADO.NETObjects
ExploringtheSystem.Data.SqlClientNamespace
ExploringtheSqlClientNamespace
ExploringtheSystem.DataNamespace
Summary
Chapter9.GettingConnected
Introduction
ConnectivityStrategiesThatIncludeSecurity
ConfiguringtheServerandFirewall
ConnectionStrategies
EstablishingaConnection
WritingCodetoCreateConnections
UnderstandingandManagingtheConnectionPool
BuildingaConnectionStringforOtherProviders
GettingVisualStudiotoBuildYourConnectionString
OpeningandClosingConnections(Semi-)Automatically
UnderstandingtheConnectionProperties
UsingtheConnectionMethods
HandlingConnectionEvents
ManagingConnectionExceptions
Summary
Chapter10.ManagingSqlCommandObjects
Introduction
CreatingSqlCommandObjects
IntegratingAdHocQueriesintoYourApplication

CodingParameterQueries
ValidatingtheValue
ExecutingStoredProcedures
Summary
Chapter11.ExecutingSqlCommandObjects
Introduction
ExecutingSqlCommandObjectsSynchronously
UnderstandingtheSqlDataReader
PopulatingDataStructures




FetchingRowsAsynchronously



ExecutingCommandsAsynchronously













































































Summary
Chapter12.ManagingUpdates
Introduction
UsingWizardstoGenerateUpdateActionCommands
UpdateAlternatives:UsingtheTableAdapterConfigurationWizard
ComplexUpdateswithServer-SideLogic
ManagingConcurrencybyDesignorCollision
Summary
Chapter13.ManagingSQLServerCLRExecutables
Introduction
EvolvingCLRExecutablesTechnology
WhereDoCLRExecutablesMakeSense?
DesigningaCLRExecutable
BuildingYourFirstCLRExecutable
BuildingandDeployingaCLRExecutable
SettingUpaTestEnvironment
WorkingwithADO.NETfromWithinCLRExecutables
CodingCLRStoredProcedures
ImplementingBasicUser-DefinedType(UDT)CLRExecutables
ImplementingAdvancedCLRUserDefinedTypes
AccessingCLRUDTsElsewhere
ImplementingCLRAggregateExecutables
ImplementingCLRTriggers
AdvancedDebugging
UDTSafetyandIPSecurity
Summary
Chapter14.CreatingandManagingReports
Introduction

UnderstandingReportingServicesandRDL
VisualStudio2005Reporting
WhatAretheVisualStudio2005ReportTools?
BuildingYourFirstReport
ExploringtheReportViewerClassinDepth
ManagingServerReports
ManagingParameters
AdvancedReportingTechniques
ImplementingtheMatrixReport



Summary

Chapter15.SummaryandWintry:WhereWeAreNow






































AppendixI.InstallingtheExamplesandTestDatabases
InstallingtheExamples
InstallingtheExampleDatabases
Chapter-SpecificConfigurationIssues
Summary
AppendixII.ReinstallingtheDACWandOtherMissingFunctionalityinVisual
Studio
AppendixIII.MonitoringSQLServer

MonitoringSQLServerwiththeSQLProfiler
MonitoringSQLServerandADO.NETwithPerformanceCounters
Summary
AppendixIV.CreatingandManagingServer-SideCursors
WhyAreServer-sideCursorsImportant?
HowDoesADO.NETImplementCursors?
HowAreServer-SideCursorsManaged?
HowCanADO.NETCreateaServer-SideCursor?
FetchingDatafromtheCursor
UpdatingwithaServer-SideCursor
Summary
Index


Copyright
Manyofthedesignationsusedbymanufacturersandsellersto
distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andthepublisherwas
awareofatrademarkclaim,thedesignationshavebeenprinted
withinitialcapitallettersorinallcapitals.
Theauthorsandpublisherhavetakencareinthepreparationof
thisbook,butmakenoexpressedorimpliedwarrantyofany
kindandassumenoresponsibilityforerrorsoromissions.No
liabilityisassumedforincidentalorconsequentialdamagesin
connectionwithorarisingoutoftheuseoftheinformationor
programscontainedherein.
Thepublisheroffersexcellentdiscountsonthisbookwhen
orderedinquantityforbulkpurchasesorspecialsales,which
mayincludeelectronicversionsand/orcustomcoversand
contentparticulartoyourbusiness,traininggoals,marketing

focus,andbrandinginterests.Formoreinformation,please
contact:
U.S.CorporateandGovernmentSales
(800)382-3419

ForsalesoutsidetheUnitedStatespleasecontact:
InternationalSales

VisitusontheWeb:www.awprofessional.com
LibraryofCongressCataloging-in-PublicationData:
Vaughn,WilliamR.


Hitchhiker'sguidetoVisualstudioandSQLserver:bestpracticearchitect
Vaughn,PeterBlackburn.
p.cm.
ISBN0-321-243625(pbk.:alk.paper)1.ApplicationsoftwareDevelopment.2.MicrosoftVisu
SQLserver.I.Blackburn,Peter,1967-II.Title.
QA76.76.A65V392006
005.3dc22
2006030355
Copyright©2007PearsonEducation,Inc.
Allrightsreserved.PrintedintheUnitedStatesofAmerica.This
publicationisprotectedbycopyright,andpermissionmustbe
obtainedfromthepublisherpriortoanyprohibited
reproduction,storageinaretrievalsystem,ortransmissionin
anyformorbyanymeans,electronic,mechanical,
photocopying,recording,orlikewise.Forinformationregarding
permissions,writeto:
PearsonEducation,Inc.

RightsandContractsDepartment
75ArlingtonStreet,Suite300
Boston,MA02116
Fax:(617)848-7047
TextprintedintheUnitedStatesonrecycledpaperatR.R.
DonnelleyandSonsinCrawfordsville,Indiana.Firstprinting,
November2006

Dedication
ToFranandJackVaughnandtoallthathavefalleninserviceof
theircountry.


MicrosoftWindowsServerSystemSeries
BooksintheMicrosoftWindowsServerSystemSeriesare
writtenandreviewedbytheworld'sleadingtechnical
authoritiesonMicrosoftWindowstechnologies,including
principalmembersofMicrosoft'sWindowsandServer
DevelopmentTeams.Thegoaloftheseriesistoprovidereliable
informationthatenablesadministrators,developers,andIT
professionalstoarchitect,build,deploy,andmanagesolutions
usingtheMicrosoftWindowsServerSystem.Thecontentsand
codeofeachbookaretestedagainst,andcomplywith,
commerciallyavailablecode.Thisseriesshouldbeaninvaluable
resourceforanyITprofessionalorstudentworkingintoday's
Windowsenvironment.

TitlesintheSeries
PaulBertucci,MicrosoftSQLServerHighAvailability,0-67232625-6(Sams)
PeterBlackburnandWilliamR.Vaughn,Hitchhiker'sGuideto

SQLServer2000ReportingServices,0-321-26828-8(AddisonWesley)
WilliamBoswell,LearningExchangeServer2003,0-321-22874X(Addison-Wesley)
RobertaBragg,WindowsServer2003Security,0-321-30501-9
(Addison-Wesley)
EricL.Brown,SQLServer2005Distilled,0-321-34979-2
(Addison-Wesley)
BillEnglish,OlgaLonder,ShawnShell,ToddBleeker,and
StephenCawood,MicrosoftContentManagementServer2002:


ACompleteGuide,0-321-19444-6(Addison-Wesley)
JohnC.HancockandRogerToren,PracticalBusiness
IntelligencewithSQLServer2005,0-321-35698-5(AddisonWesley)
DonJones,ManagingWindows®withVBScriptandWMI,0321-21334-3(Addison-Wesley)
SakariKoutiandMikaSeitsonen,InsideActiveDirectory,
SecondEdition:ASystemAdministrator'sGuide,0-321-228480(Addison-Wesley)
JasonNadrowskiandStacyDraper,SharePoint2003Advanced
Concepts,0-321-33661-5(Addison-Wesley)
ShyamPather,MicrosoftSQLServer2000NotificationServices,
0-672-32664-7(Sams)
MichaelRaheem,DimaSonkin,ThierryD'Hers,andKami
LeMonds,InsideSQLServer2005Tools,0-321-39796-7
(Addison-Wesley)
JeffreyR.ShapiroandMarcinPolicht,BuildingHighAvailability
WindowsServer™2003Solutions,0-321-22878-2(AddisonWesley)
WilliamR.VaughnwithPeterBlackburn,Hitchhiker'sGuideto
VisualStudioandSQLServer:BestPracticeArchitecturesand
Examples,0-321-24362-5(Addison-Wesley)
BuckWoody,Administrator'sGuidetoSQLServer2005,0-32139797-5(Addison-Wesley)
Formoreinformationpleasegoto

www.awprofessional.com/msserverseries




Foreword
In1992,MicrosoftfirstlaunchedMicrosoftAccessVersion1.0as
acompetitorforFoxPro(whichitbought),Btrieve,Paradox,
PowerBuilder,andDBASE.ManythinkthatthiswasMicrosoft's
firstforayintotheworldofdatabaseengines.Itwasn'tMicrosoft
introduceditsfirstDBMSsystemin1988whenitjoinedwith
SybaseandAshton-TatetolaunchitsownversionofSQL
Server.WhiledesignedforusewithOS/2,Microsoftquickly
movedtoleveragetheconsiderableworktheyhadbeendoing
ontheirnewNToperatingsystem.ThismadetheMicrosoft
versionfaster,smaller,andmorecompetitive.Itwould
eventuallybecomethemarketleaderinaverycompetitive
DBMSindustry.
Microsoft'sfirst"RAD"developmenttoolforWindowswas
createdin1991withtheintroductionofVisualBasic.While
VisualBasictookthreeversionstointegratedataaccessintoits
userinterface,VisualBasicwasnotthefirstMicrosoftBASIC
languagetoaccessSQLServer.ThathonorgoestoQuickBasic
afteraMicrosoftdeveloperworkingontheSQLServerteam
builthisowndataaccessinterfacetomakeiteasiertoaccess
SQLServer'sonlypublishedAPIinterface,DB-Library.Again,
VisualBasichasevolvedintotheworld-classVisualBasic6.0
andmorerecentlyVisualBasic.NETlanguages.Muchofthe
successofSQLServercanbedirectlytiedtotheabilityof
developersatallskilllevelstocreatedataaccessapplications

thatleverageSQLServer'spower,scalability,andflexibility.
IjoinedMicrosoftin1988whereIhadthepleasureofserving
asthefirstprogrammanagerforSQLServer.Ourteamsworked
withSybaseearlyonandeventuallyhelpedcreatetheOpen
DatabaseConnectivity(ODBC)standard.Laterinmycareer,we
helpedbringtogethertheVisualStudiofamilyofdeveloper
toolsanddrivetheWin32API,customerrequirements,and


productspecificationfortheMicrosoftWindowsNToperating
system.Sincethen,Ihaveheldmanydifferentrolesat
Microsoftandmostrecentlyhavetakenontheresponsibilityof
SeniorVicePresidentoftheServerandToolsbusinessunitthat
encompassesbothSQLServerandthedevelopmentlanguages.
Duringtheseyears,weallwitnessedSQLServer'smarketshare
growsteadilyfroman"allother"slicetoover50%market
shareandVisualBasicgrowtobethemostpopularlanguageon
theplanet.However,oneproblemMicrosoftfacedthroughout
thisevolutionaryperiodwasdocumentation,training,andusereducation.SincetheSQLServerdocumentationteamfocused
itsattentionprimarilyonSQLServer,andtheVisualStudioUser
Educationteamfocusedprimarilyonuserinterface,tools,local
data,andlanguageissues,agapwascreatedthatonly
someonefamiliarwithbothdisciplinescouldtackle.
FromtheveryearliestversionsofSQLServer,whileworkingfor
MicrosoftUniversity,BillVaughnwroteSQLServercourseware,
managedandmentoredSQLServertrainers,andwrotebooks
andarticles.Thisentirebodyofworkwasfocusedonhelping
developersunderstandhowSQLServeranddevelopment
languageslikeVisualBasicandVisualBasic.NETcanbeusedto
bestleveragethepowerofSQLServer.HiseffortstotieSQL

ServerandVisualBasictogetherwerecontinuedwhilehe
workedfortheVisualBasicusereducationteamandsince
retiredfromMicrosoftin2000.IfirstmetBillin1988,andhe
wasoftenathorninmyteam'ssideashelobbiedformore
emphasisonSQLServerandITdataissuesandbetteraccess
toSQLServer'ssophisticatedfeatures.ItwasclearthatBillwas
notafraidtoexpresshisopinionsonhowthelanguagesand
toolsshouldbeadaptedtohandlewhathecalled"ITdata."I
guessthisisbecauseBillhadworkedpredominantlywithvery
largedatabasesatElectronicDataSystemsandearlierinhis
34-yearcareer.SinceBillcameincontactwithsomanyIT
developerswhileatMSU,manyofhisideasweretemperedwith
real-worldfieldexperiencesofferedbyhisstudentsand


conferenceattendees.No,wedon'talwayslikewhatBillsaysin
hisbooks,butwerespecthispointofview.WhenBillseesan
issuewithSQLServer,orthelanguages,orhowtheyinteract,
heletsusknowthroughhisbooksandarticles.Clearly,Billisan
independentthinker,andwhilehecertainlyknowsandendorses
Microsofttechnology,he'squicktopointoutwhatworks,what
doesn't,andhowdeveloperscanworkaroundtheissues.
Overthelast22years,Billhascontributedasignificantamount
ofqualitydataaccessdocumentationandtraining.Hisefforts
havealsoyielded(now)seveneditionsofhiswell-respected
Hitchhiker'sGuides,aswellasthreeadditionalADOand
ADO.NETbooksmanyofwhichhavebeentranslatedintonearly
adozenlanguages.Developersallovertheworldhavelearned
todependonandrespecthisvastbodyofwork.
ThismostrecentbookhasbeenamonumentaleffortforBill.

Workingalmostthreeyearsonthisedition,Billhasdrawnon
manyrespectedindustrysourcesaswellasmanyofmyteam
membershereatMicrosoft.He'sattendedandactively
participatedinanynumberofprofessionalconferencesand
beeninvitedtoourownMicrosoftsoftwaredesignreviews
whereProgramManagersgatherfeedbackandsuggestions
fromindustryexperts.Hisinputwasinvariablyon-targetforthe
developercommunityherepresents.
We'reextremelyexcitedbythesuccessof.NETand,with2.0,
theopportunityforVisualStudiocontinues.Oneofthereasons
IcanheartilyendorseBill'slatestbookisthatitsimplymakesit
easierfordevelopersatallskilllevelstogetuptospeedquickly
on.NETtechnologyusingprosethatanyofthemcan
understand.Isupporthiseffortsandrecommendthistext
stronglytodevelopers.
BobMuglia
SeniorVicePresidentoftheServerandToolsBusiness(STB),a
partofthePlatforms&ServicesDivisionatMicrosoft





Acknowledgments
PeterBlackburn
I'venowknownPeterformanyyears.Duringthattime,he's
beenmytechnicalrock.Hekeepsmeontrackinanynumberof
areasselflesslyprovidinghistimeandexpertisewheneverand
whereverhecan.He'saclosefriend,farbeyondbeinga
technicalmentor.Peter'sgreatestqualitiesarehisinsight,

honesty,andintegrity.Hestridentlychallengesallof
usdevelopersandcitizensaliketoprotectourselvesagainst
thosewhowouldsteal,pilfer,andvandalizeourdata,
intellectualproperty,andthethingswe'veworkedsohardto
achieve.He'sshownmecracksinthesecuritystrategiesunder
discussionandhoweasyitcanbetogetinbuthisscruples
preventhimfromcapitalizingonthoseflaws.I'mjustgladhe's
on"our"side.Asaresult,he'sbeenhiredbysomeofthe
largestfirmsintheworldtoreviewtheirsystemstohelpfill
thosechinksintheirarmor.Idon'tknowthatIcouldhave
writtenthisbookwithoutPeter.Hehashelpedmemakesure
thetechnicaldetailsarerightandkeptmeontrackwithsome
oftheuglieraspectsofVisualStudioandSQLServerlikeC#and
(ugh)XML.Peter,thanks.
MicrosoftDevelopmentTeams
Iwasveryprivilegedthroughoutthewritingofthisbookto
haveadirectaccesstokeymembersofthedevelopmentteams
atMicrosoft.Yes,someofthisaccessisduetomystatusasa
MicrosoftMVP,butsomeofitisbecauseIconsidermanyof
thesepeoplefriendsI'veworkedwiththemformanyyears
beforeandaftermy"retirement."Insomeways,this
relationshiphasbeensymbioticasIpointoutissues,theteam
eithertellsmethey'llfixit,theyshowmewhyit'snotanissue,
ortheyputitonthestackofissuestofixoneday.I'veseen
thisinteractionresultinbetterproductsandcertainlyenabled


metoproduceabookofmuchhigherqualitythanwould
otherwisebepossible.


SahilMalik,Winsmartsauthor,trainer,andconsultant
SteveLasker,MicrosoftPM/TechnicalLeadfortheUiFXandService
BrianRandall,MCWTechnologiesSr.consultant
RobertGreen,MCWTechnologiesSr.consultant
DavidSceppa,MicrosoftPM
PabloCastro,ADO.NETTechnicalLead
BillyHollis,authorandconsultant
Whenthebookwasreadyfortechnicalreview,manyofthe
peopleontheMicrosoftcampuswerebusygrindingoutthenext
versionsandservicepacksofVisualStudioandSQLServer.No,
Idon'tthinkthiseffortwassimplyanattempttomakemy
latestbookobsoleteatleastIhopenot.Thesamewastruefor
manyotherswhostillprovidedsomeoftheirtimetoprovide
feedbackandencouragement.Iappreciatethehelptheywere
abletoprovideoverthetwoyearsittooktowritethisbook.
TheAddisonWesleyTeam
Ofcourse,thebookwouldnothavebeendoneatallwithout
youfolks.Thanksforputtingupwithmeandmystrangeideas
andunreasonabledemands.IncludedinthislistareJohnFuller,
JohnWait,KarenGettman,CurtJohnson,ElizabethHurley
Peterson,AndyBeaster,EricGarulay,NeilRowe,MarkRenfrow,
andahostofothers.Thanks,all.Andthanksforgettingthe
bookthroughtheproductioncycleinrecordtime.Pleasestrike
thislastlineifwedon'tmaketheNovember6thdate.;)
MarilynVaughn
Marilynhas(again)helpedkeepthegrandkids,cats,and
salesmenoutofmyofficewhileIwrotethisfinalbook.Shewas
theretolistentomyincomprehensibleaccountsofhowtheday
wasgoingandtonodattherighttime.Shewastheretokeep
meoutoftroublewhenIwentontheroadandonlycollapsed



oncewhileshoppingonthestripinLasVegas.Thanks.
VictoriaBallard(George)andChrissyVaughn(Fred)
Ladies,youaremyfinestachievement.Sinceyouhaveyour
ownlives,youcan'ttakethetimetorevieworcopyeditormake
sureI'mnotoffendingthepeopleinsomesmalltownormajor
countryanymore.Butthelessonsyou'vetaughtmeoverthe
lastfewdecadesaresewnintothefabricofallIwrite.Iam
veryproudofbothofyou.Thanks.


AbouttheAuthors
WILLIAMR.VAUGHNhasworkedinthecomputerindustry
since1972.HeholdsaBachelor'sdegreeinComputerScience
fromMaryHardin-BaylorandaMaster'sdegreein
InterdisciplinaryStudiesfromtheUniversityofTexas.He'salso
beenawardedanHonoraryPhD.fromtheUniversityof
AdvancingComputerTechnologyinTempeArizona.Billspent
hisearlyyearsworkinginthemainframedataprocessing
industryandtransitionedtothepersonalcomputersideinthe
late70s.Alongtheway,heworkedfortheTexasDPSNarcotics
Service,EDS(wherehewasrecruitedbyandworkedforRoss
Perot),atMostek/UnitedTechnologies,ChallengeSystems,
DigitalResearch,andCPTCorporation.Afterhavingsurfedthe
PCindustryformanyyears,hebeganhisMicrosoftyearsin
1986workingfortheWindowsdeveloperliaisonteamat
Microsoftin1986.Forthenext14years,heworkedinvarious
divisionsatMicrosoftincludingMicrosoftUniversity,theVisual
BasicdocumentationandVisualStudiomarketingandInternal

TechnicalEducationteamsbeforeretiringin2000toformhis
owncompany,BetaVCorporation.Billhaswrittenseven
editionsofthepopularHitchhiker'sGuide(the4th,5thand6th
publishedbyMicrosoftPress)andbooksforAPress,including
thebestsellerADOandADO.NETExamplesandBestPractices.
PeterBlackburnandBillalsocoauthoredtheHitchhiker'sGuide
toSQLServer2000ReportingServices(Addison-Wesley).His
latestworkisHitchhiker'sGuidetoSQLServerEverywherehis
firste-Book.HewritesleadarticlesforSQLServerMagazine
whereheisacontributingeditor,MSDN,andothers.Billalso
writesabi-weeklyeditorialforProcessor.COMmagazine.Billis
atop-ratedspeakeratconferencesworldwide,including
keynotesandsessionsatTechEd,DevWeek,DevConnections,
SQLConnections,VBUG,andmanyothers.HeisaMicrosoft
MVPandamemberoftheINETASpeaker'sBureau.


PETERBLACKBURNhasworkedinthecomputerindustry
since1981.HestudiedcomputerscienceatCambridge
University,EnglandfromwhereheholdsanM.A.degree.
Throughhisconsultingcompany,BoostDataLimited,Peterhas
designed,built,andimplementedsmall-andlarge-scale
databasesystemsincludingreportingsystemsbasedonSQL
Server.Hehascontributedcountlesshourstothedevelopment
andhoningofMicrosoftReportingServicesandremainsdirectly
involvedwiththedevelopmentteam.HeisalsoaMicrosoftMVP.
Hesupportsdevelopersthroughnewsgroupsandbeta
programs,andtrainsteamsofdevelopersworkingwithSQL
ServerandReportingServices.Havingworkedcloselywith.NET
sincebeforethelaunch,PeterandBoostDatahaveensuredthe

technicalaccuracyofmanyleading.NETbooks.Peterlivesin
theUnitedKingdomandtravelsallovertheworldtoconsult,
speak,andprovidesupportforhisfellowdevelopers,fellow
MVPs,hiswritingteam,andMicrosoftitself.


Introduction
Welcome.It'sbeenawhilesinceIwrotemylastHitchhiker's
Guidethatfocusesonapplicationdesignanddevelopment.The
previousbookinthisseries,Hitchhiker'sGuidetoVisualBasic
andSQLServer,6thEdition,wasfirstpublishedbyMicrosoft
Pressin1998whileIwasstillworkingforMicrosoft'sInternal
TechnicalEducationgroup.VisualBasic6.0hadjusthitthe
streets,andSQLServer7.0wasabouttobelaunched.The
introductionfromthesixtheditionobservedthatalotof
importantchangeshadbeenmadesincetheprevious
editionsignificantchangestoVisualBasic,ADO,SQLServer,and
thetoolsandtechniquestoconnectthem.Ididn'tthinkthatthe
technologycouldchangemuchmoreradicallythanintroducing
afullycompiledVisualBasicandanewversionofafairly
sophisticateddataaccessinterface(COM-basedADO)todrive
it.Iwaswrong.
Today,giventhecurrentstateofSQLServerandwhatMicrosoft
calls"VisualBasic,"sayingthatalothaschangedoverthelast
sevenyearswouldbeagrossunderstatement.JustbeforeI
retiredfromMicrosoftin2000,Microsoftwalkedawayfromits
COM-basedversionofVisualBasic(6.0)asitintroducedits
successor:VisualBasic.NETbuiltonthenew.NET
FrameworkthefoundationforVista.Atthetime,itwasclear
thatthesechangeswouldrequireacover-to-coverrewriteof

myHitchhiker'sGuide,butIwasnotinapositiontotakeona
projectofthismagnitudenotuntilthedusthadsettledon.NET.
Instead,IwrotetwomorefocusedbooksforApress:ADOand
ADO.NETExamplesandBestPracticesforVisualBasic
Programmers,forVisualBasic6.0developerstransitioningto
VisualBasic.NET;and(withPeterBlackburn)aC#version:
ADO.NETExamplesandBestPracticesforC#Programmers.
NeitheroftheseADO-focusedbooksreallyaddressedmanyof
thefundamentalarchitecturalconceptsandtechniquesincluded


inpreviouseditionsoftheHitchhiker'sGuide.
Alongtheway,PeterBlackburncameonboardandwas
instrumentalingettingthesetwoApressbookstomarketand
subsequentlyconvincedmetowriteamorefocusedbookonhis
favoritetopicSQLServerReportingServices.Sincethenext
versionofVisualStudio(Whidbey)wasnotdueforanother
year,itseemedlikeagoodidea(atthetime).Thisprojectwas
expectedtogeneratea200-pagebookinaboutthreemonths.
Inactuality,ittookoverayeartogrindout,butHitchhiker's
GuidetoSQLServer2000ReportingServices(Addison-Wesley)
isa780-pagetomethat'sthemostrespectedbookonSQL
ServerReportingServicesyetpublished.Peterdidthebulkof
theresearchandinitialwriting,andprovidedsignificant(and
greatlyappreciated)technicalguidanceandlogisticalsupport
fortheseventhedition.





HowDidIGettoThisPoint?
What'ssospecialabouttheHitchhiker'sGuideseries?Well,
perhapsabitmorehistorywillhelpclearthisup.Inthelate
1980s,IworkedforMicrosoftUniversity(MSU)writingand
deliveringcoursewareonanynumberofnow-obsoletetechnical
subjectslikeOS/2andQuickBasic.WhenMicrosoftestablished
apartnershipwithSybasetoco-marketanddevelopanOS/2
versionofSQLServer,MSUandIwererecruitedtobuild
coursestoteachdevelopersrelationaldatabasedesign,TSQL
programming,DBLibraryprogramming,andotherrelated
subjects.Imanagedandcontributedcoursewaretothegroup
oftrainerswhowroteanddeliveredthiscoursewareforalmost
fiveyearsoftenthreetofivedaysaweek,threeweeksamonth.
Alongtheway,wealllearnedagreatdealaboutSQLServer
andbestpractices.
WhenMSUfolded,IwrotemyfirstHitchhiker'sGuide:
Hitchhiker'sGuidetoVBSQL.No,thetitlehadnothingtodo
withDouglasAdam'sbookitwastobea"tourguide"likeEurope
on$5aDayforSQLServerfront-endVisualBasicdevelopers.
Thebook'smanuscripthelpedmegetawriter'sslotonthe
VisualBasicdocumentationteam.Thefirsteditionwasafolksy
tongue-in-cheektreatmentofVisualBasic(1.0),DBLibrary,and
SQLServer,andhowtheycouldinterconnectthetipsand
techniquesweredrawnfromthecoursewareIhadwrittenand
myinteractionwithSQLServerdevelopersandMSUstudents.
Usingsomeprettysillyandirreverentexamplesandprose,I
wasabletomakeafairlydrytopichumorousandvery
readable,whilestillgettingtheheavytechnicalcontentacross.
ItookthefirsteditiontoMicrosoftPressforpublication,but
(strangelyenough)theywantedaPowerBuilderbook,notone

ona(then)obscureDBMSlikeSQLServer.Asaresult,I
publishedthefirstthreeeditionsmyselfandeventuallysold
severalthousandcopiesoutofmyhomethesefirstthree


editionsmadetheirwaytocustomersandbookstoresallover
theworld.IevensoldasinglecopytoafellainHongKongwho
madeitverypopularinChinatoobadIdidn'tgetanythingback
fromthesecopies.
EachsubsequenteditionoftheHitchhiker'sGuideleveragedthe
previousasIexpandedmyunderstandingofVisualBasicand
SQLServerandastheseproductsevolvedandmatured.Each
editionfocusedonthelatestVisualBasicandSQLServer
interfacesandfeatures,andeachbecamethedefinitivesource
forinformationonODBC,DAO,ODBCDirect,ADO,andthe
VisualBasictoolsusedtoaccessthesedataaccessinterfaces.I
liketothinkthatthebookitselfhelpedfocusMicrosoftandthe
dataaccessteamsonaddressingmanyreal-worldissuesthat
mystudents,customers,andreadersconstantlyrelayedtome.
AsIcreatednewsolutionstocommonproblems,Iwouldfold
theseintothenextedition.Overtheyears,I'vespent
considerabletimeinteractingwiththedevelopercommunityat
conferences,vianewsgroups,andintrainingsessions.Ifyou've
metmeandmadeagoodsuggestionforabetterwaytohandle
adataaccessissue,ithasprobablyendedupinthebook
somewhere.
Eventually,Hitchhiker'sGuide'spopularityencouragedMicrosoft
Presstoasktopublishthefourthedition.Afterwecametoan
understandingIwouldmaintainfulleditorialcontrol(thejokes
andMicrosoftbarbshadtostay)Irelentedandthesoylentgreenfourtheditionwaspublished.MicrosoftPress

subsequentlypublishedtheupdatedfifthandsixtheditionsover
thenextfewyears;itwassubsequentlytranslatedintoatleast
eightlanguages,includingJapanese,Spanish,French,German,
Hungarian,Italian,Korean,andChinese.




×