Beginning SQL Server 2005Express Database Applications with Visual

Total Page:16

File Type:pdf, Size:1020Kb

Beginning SQL Server 2005Express Database Applications with Visual 5238CH00_FM 11/18/05 4:29 PM Page i Beginning SQL Server 2005 Express Database Applications with Visual Basic Express and Visual Web Developer Express From Novice to Professional Rick Dobson 5238CH00_FM 11/18/05 4:29 PM Page ii Beginning SQL Server 2005 Express Database Applications with Visual Basic Express and Visual Web Developer Express From Novice to Professional Copyright © 2006 by Rick Dobson All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN (pbk): 1-59059-523-8 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editors: Tony Davis and Matthew Moodie Technical Reviewer: Cristian Lefter Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis, Jason Gilmore, Jonathan Hassell, Chris Mills, Dominic Shakeshaft, Jim Sumser Project Manager: Beth Christmas Copy Edit Manager: Nicole LeClerc Copy Editors: Damon Larson and Freelance Editorial Services Assistant Production Director: Kari Brooks-Copony Production Editor: Kelly Winquist Compositors: Dina Quan and Diana Van Winkle, Van Winkle Design Group Proofreader: April Eddy Indexer: Valerie Perry Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit http://www.springeronline.com. For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://www.apress.com. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com in the Source Code section. You will need to answer questions pertaining to this book in order to successfully download the code. 5238CH00_FM 11/18/05 4:29 PM Page iii Contents at a Glance About the Author. xiii About the Technical Reviewer . xv Acknowledgments. xvii Introduction. xix PART 1 ■ ■ ■ Working with SQL Server Express ■CHAPTER 1 Getting Started with SQL Server Express . 3 ■CHAPTER 2 Graphical and Command-Line Query Tools . 33 ■CHAPTER 3 Exploring, Creating, and Recovering Databases . 73 ■CHAPTER 4 Data Types, Tables, and Constraints . 107 ■CHAPTER 5 Creating Queries from a Single Database Object . 155 ■CHAPTER 6 Querying Multiple Database Objects and Manipulating Result Sets . 191 ■CHAPTER 7 Leveraging Database Objects That Encapsulate T-SQL . 247 ■CHAPTER 8 Managing SQL Server Express Security. 307 PART 2 ■ ■ ■ Working with Visual Basic Express and Visual Web Developer Express ■CHAPTER 9 Introduction to Visual Basic Express and Windows Forms. 371 ■CHAPTER 10 Introduction to Visual Web Developer Express, Web Pages, and Web Forms . 409 ■CHAPTER 11 Programming ADO.NET . 445 ■CHAPTER 12 Programming DataAdapter and DataSet Objects . 485 ■CHAPTER 13 Using Visual Database and Form Design Tools . 515 ■INDEX . 575 iii 5238CH00_FM 11/18/05 4:29 PM Page iv 5238CH00_FM 11/18/05 4:29 PM Page v Contents About the Author. xiii About the Technical Reviewer . xv Acknowledgments. xvii Introduction. xix PART 1 ■ ■ ■ Working with SQL Server Express ■CHAPTER 1 Getting Started with SQL Server Express. 3 What Is SQL Server Express? . 3 Who Is SQL Server Express For? . 5 Hobbyists and Other Nonprofessional Developers . 6 Business Analysts . 6 Database Administrators and Operations Specialists . 7 Professional Developers in Need of a Free, Modern Database . 8 SQL Server Express vs. SQL Server 2005 . 9 Similarities . 9 Differences . 10 SQL Server Express vs. MSDE . 11 Installing SQL Server Express. 12 Performing a System Check for SQL Server Express. 12 Registration, Feature, and Instance Name Screens . 13 Service Account and Authentication Mode Screens. 14 Collation, Error Reporting, and Ready to Install Screens . 15 Using SQL Server Express Query Tools . 16 Query Tools for SQL Server Express . 17 Configuring SQL Server Express to Start Automatically. 17 Configuring SQL Server Express for Network Access . 19 Configuring the Windows XP Firewall for SQL Server Express . 21 Connecting from the SSMS-Based Query Tool . 22 Connecting from Remote Down-Level Clients . 24 Installing Sample Databases . 24 Connecting to SQL Server Express from Visual Studio 2003 . 25 Connecting to SQL Server Express from Access Projects . 27 Connecting to SQL Server Express from Access Linked Tables . 28 Summary . 31 v 5238CH00_FM 11/18/05 4:29 PM Page vi vi ■CONTENTS ■CHAPTER 2 Graphical and Command-Line Query Tools . 33 Using the SSMS-Based Query Tool . 33 Connecting to SQL Server Instances . 34 Using Database, Table, and View Designers . 41 Designing, Running, Saving, and Rerunning SQL Scripts . 51 Using the sqlcmd Utility. 60 Connecting to SQL Server Instances . 60 Running Statements from a File. 62 Saving Output to a File . 64 Dynamically Running and Batching sqlcmd Statements . 65 Summary . 71 ■CHAPTER 3 Exploring, Creating, and Recovering Databases . 73 Overview of Databases . 73 Introducing Database Concepts . 74 Types of Databases . 75 Getting Meta Data About Databases . 75 Using sp_helpdb for Database Help. 76 Using System Catalog Views . 78 Searching for and Copying Databases with Windows Explorer. 83 Using CREATE DATABASE . 84 Just Naming the Database . 84 Designating Data Files in the ON Clause. 85 Using the LOG ON Clause . 87 Attaching and Detaching Databases . 88 Attaching Databases with CREATE DATABASE . 89 Copying Files, the Auto-Close Feature, and sp_detach_db . 95 Backing Up and Restoring Databases . 98 Overview of Database Recovery Models . 99 Choosing and Modifying a Database’s Recovery Model . 101 Performing a Full Data Backup and Restore . ..
Recommended publications
  • Ideablade Devforce Installation Guide
    DevForceDevForce Silverlight WinClient Installation Guide DevForce Silverlight Installation Guide Table of Contents Table of Contents Preface ................................................................................................................................ 1 Installation .......................................................................................................................... 2 Product Prerequisites ........................................................................................................................... 2 Pre-installation Checklist ...................................................................................................................... 2 Installing DevForce Silverlight .............................................................................................................. 4 Post-Installation Tasks ......................................................................................................................... 6 Updating Existing Applications....................................................................................... 7 Consult the Release Notes ................................................................................................................... 7 Upgrading DevForce Versions.............................................................................................................. 7 Upgrading DevForce Editions ............................................................................................................. 11 Troubleshooting
    [Show full text]
  • Billquick-SQL Server 2012 Express Installation Guide
    INSTALLATION GUIDE BillQuick-SQL Server 2012 Express Installation BillQuick-SQL Server 2012 Express Installation BillQuick | Power Up Your Business (866) 945-1595 | www.bqe.com | [email protected] INSTALLATION GUIDE BillQuick-SQL Server 2012 Express Installation CONTENTS SQL EXPRESS INSTALLATION 1 SYSTEM REQUIREMENTS 1 INSTALLING SQL 2012 EXPRESS 1 SQL EXPRESS CONFIGURATION 8 BILLQUICK DATABASE 11 BillQuick | Power Up Your Business (866) 945-1595 | www.bqe.com | [email protected] INSTALLATION GUIDE BillQuick-SQL Server 2012 Express Installation SQL EXPRESS INSTALLATION The Microsoft® SQL Server® 2012 Express software is the database engine you will use to store and report on data in BillQuick (Basic, Pro and Enterprise editions). It is available free from Microsoft and is a replacement for MSDE and SQL 2005. We do not recommend using SQL Server 2005 that might be installed with your Windows Server because other software programs that rely on that SQL Server instance can break if you attempt to install service pack updates on them. System Requirements You can check Microsoft Download Center to download Microsoft SQL Server 2012 R2 SP2. Click to know about the system requirements and installation instructions. Hardware/Software Requirements To know about the hardware and software requirements, go to Microsoft Developer Network . Installing SQL 2012 Express Please follow the steps below to install SQL Server 2012 Express edition. If you prefer, click here to watch a video on installing SQL Server Express. 1. Download the appropriate SQL Server 2012 Express setup to your desktop. Express Version System Microsoft® SQL Server® 2012 Express SP1 For 32-Bit machines, download the file: SQLEXPRWT_x86_ENU.exe For 64-Bit machines, download the file: SQLEXPRWT_x64_ENU.exe 2.
    [Show full text]
  • SQL Server Express: Setting up for Unistream User Guide 3/17
    Headquarters Unitronics (1989) (R"G). Unitronics Building, Airport City P.O.B. 300, Ben Gurion Airport, Israel 70100 Tel: + 972 (3) 977 8888 Fax: + 972 (3) 977 8877 SQL Server Express: Setting up for UniStream User Guide 3/17 Contents SQL Server Express: Setting up for UniStream ...................................................... 1 Overview ....................................................................................................... 1 Supported Controllers ...................................................................................... 1 First-time Installation & Configuration ................................................................. 2 Download ...................................................................................................... 2 Installing SQL Server ...................................................................................... 3 Setting up the Local Database .......................................................................... 5 Configuring SQL Server ................................................................................... 6 Activating the SQL Server Browser. ................................................................ 6 Enable TCP/IP, Assign Port ............................................................................ 7 Create a new Login ....................................................................................... 8 SQL Server Express—Existing Installation ........................................................... 10 Enable TCP/IP, Assign Port
    [Show full text]
  • Syncstudio Requirements
    Hardware and Software Requirements The SyncStudio Sync Management Console and the custom generate Sync Web Service run on Windows OS systems. We support Windows 7, 8.1, 10 and Windows Server 2012 or 2016. Win XP is not supported. For production environments, we recommend Windows Server. We support both virtual and physical machines. The machine needs to have IIS 7 or above installed, enabled and with the features/roles as per our quick start guide. .NET Framework 3.5 is the minimum but 4.6 or higher is recommended. The server database can be either MS SQL SERVER or MS SQL EXPRESS versions 2008, 2010, 2012, 2014, 2016. Version 2014 and above is recommended. If you don’t have MS SQL Server, you can download SQL Server Express from this link: MS SQL Server 2016 Express Edition In SQL add login NT AUTHORITY\NETWORK SERVICE and make it a db owner of the selected SQL database. Visual Studio – SyncStudio depends on portions of Visual Studio to perform automated code generation. If you’ve installed a full license of Visual Studio 2010 or above, then you are good to go. If you do not own a full license, then you can use the Free Visual Studio Express or Visual Studio Integration Shell 2010. Minimum Microsoft Visual Studio 2010 or 2012 SyncStudio does not require that you own a full license of Visual Studio. You do however need to have installed one of the following… - Microsoft Visual Studio Integration Shell 2010 - Microsoft Visual Studio Express for Web 2010 or 2012 - Microsoft Visual Studio 2010 or 2012 full license Windows Firewall - Turn off firewall or configure pass thru as needed.
    [Show full text]
  • Xactimate 28 Network Installation Guide
    Network Installation Guide © 2011-2013 by Xactware . All rights reserved. Xactware, Xactimate, Xactimate Online, XactNet, and/or other Xactware products referenced herein are either trademarks or registered trademarks of Xactware Solutions, Inc. Other product and company names mentioned herein may be the trademarks of their respective owners. (031213) www.xactware.com Xactimate version 28 Network Installation Guide INTRODUCTION Like all networked software applications, Xactimate must be installed on a workstation connected to a network that has been properly set up and mapped to a shared drive (this document uses the X drive as an example). Xactware recommends that a certified network technician set up and administer the network. It is recommended for a network installation of Xactimate to use the physical disc. For instructions about how to set up a network installation of Xactimate via the downloadable version, visit the eService Center at https:/ / eservice.xactware.com/apps/esc/ Xactimate v28.0 Network Installation Guide Page 1 Introduction SYSTEM REQUIREMENTS - XACTIMATE V28.0 NETWORK INSTALLATION Specifications Minimum Requirements Recommended Requirements Processor Single Core Processor 1.5GHz Dual Core Processors Operating System Windows 8 (32 bit, 64 bit) Windows 7 (32 bit, 64 bit) Windows Vista (32 bit, 64 bit Business, 64 bit Ultimate) Windows XP Service Pack 3 *Windows RT is not Supported Video Card Open GL 2.0 Compatible with 128 Open GL 2.0 Compatible with MB of VRAM and Latest Drivers 512 MB of VRAM and Latest Drivers
    [Show full text]
  • Avaya Contact Center Express Release 5.0 Installation Guide
    Avaya Contact Center Express Release 5.0 Installation Guide Release 5.0 August 2010 © 2005 to 2010 Avaya Inc. All Rights Reserved. Trademarks Avaya and the Avaya logo are either registered trademarks or trademarks of Notice Avaya Inc. in the United States of America and/or other jurisdictions. While reasonable efforts were made to ensure that the information in this All other trademarks are the property of their respective owners. document was complete and accurate at the time of printing, Avaya Inc. can assume no liability for any errors. Changes and corrections to the information Downloading documents in this document might be incorporated in future releases. For the most current versions of documentation, see the Avaya Support Web Documentation disclaimer site: Avaya Inc. is not responsible for any modifications, additions, or deletions to http://www.avaya.com/support the original published version of this documentation unless such modifications, Avaya support additions, or deletions were performed by Avaya. Customer and/or End User agree to indemnify and hold harmless Avaya, Avaya's agents, servants and Avaya provides a telephone number for you to use to report problems or to ask employees against all claims, lawsuits, demands and judgments arising out of, questions about your product. The support telephone number or in connection with, subsequent modifications, additions or deletions to this is 1-800-242-2121 in the United States. For additional support telephone documentation to the extent made by the Customer or End User. numbers, see the Avaya Support Web site: http://www.avaya.com/support Link disclaimer Avaya Inc. is not responsible for the contents or reliability of any linked Web sites referenced elsewhere within this documentation, and Avaya does not necessarily endorse the products, services, or information described or offered within them.
    [Show full text]
  • Windows 10 Configuration Requirements 1.) Disk Space Requirement A) Minimum 80GB Disk Space
    Windows 10 Configuration Requirements 1.) Disk Space Requirement a) Minimum 80GB disk space 2.) Turn on Windows Features for Web Services * Assume Windows 10 has already installed properly a) Right click on “Windows Start icon” on desktop at bottom left hand corner, b) Select “Control Panel” c) Select “Program and Features” in dialogue box, d) Select “Turn Windows Features on or off” on left panel in the dialogue box, e) Turn on Windows Features by selecting its check box (See Figure 1.) f) Click “OK” button when done. Figure 1. Turn on Windows 10 Features Windows 10 Configuration Requirements 3.) Web Services Configuration ASP.Net State Service Require Start Automatically a) Login with administrator privilege, Windows 10 Configuration Requirements b) Right click on “Windows Start icon” on desktop at bottom left hand corner, c) Select “Control Panel” in dialogue box, d) Left double click “Administrative Tools”, e) Left double click “Services”, f) Right click on ASP.net State Service; and left single click on “Properties”, g) Change “Manual” to “Automatic” on Startup type by using drop down arrow, h) Click “Start” to start the service; then click “OK”,, 4.) Directories Require Full Permission in Drive C: a) Open Windows Explorer in the bottom taskbar b) Expand “This PC”, then left double click on “Local Disk (C:)” on the right hand side panel c) Right single click on Inetpub folder on Drive C, d) Left single click on “Properties”, e) Left click on “Security” tab on Inetpub Properties, f) Left click on “Edit” button; then click “Add” button g) Type “Network Service” in “Enter the object names to select”, and click “Check Names” h) Then click “OK” button, i) Put a “Check Mark” on Full Control under “Allow”, j) Click “Apply” button.
    [Show full text]
  • Installing SQL Server Express Editions
    Installing SQL Server Express Editions For v9.0 (and above) of Halcyon Network Server Suite, Advanced Reporting Suite, Performance Analyzer GUI and Disk Explorer GUI About this Guide This document provides basic installation and configuration instructions for Microsoft SQL Server Express Editions for v9.0 (and above) installations of Halcyon Network Server Suite, Advanced Reporting Suite, Performance Analyzer and Disk Explorer GUI. Copyright Copyright 2013 - 2016 Halcyon - A Division of HelpSystems. All rights reserved. • SQL Server is a registered trademark of Microsoft Corporation in the uNited States and other countries. • Windows is a registered trademark of Microsoft Corporation in the United States and other countries. This document is intended as a guide to using Halcyon software. This documentation contains Halcyon proprietary and confidential information and may not be disclosed, used, or copied without the prior consent of Halcyon Software, or as set forth in the applicable license agreement. Users are solely responsible for the proper use of the software and the application of the results obtained. Although Halcyon Software has tested the software and reviewed the documentation, the sole warranty for the software may be found in the applicable license agreement between Halcyon Software and the user. Publication Revision: August 2016 C HAPTER CHAPTER 1SYSTEM REQUIREMENTS The following system requirements must be in place in order for the installation of Microsoft SQL Server Express Editions to be successful. 64-bit configuration is required for any 64-bit versions of Windows. V9.0 of Network Server Suite, Performance Analyzer GUI and Disk Explorer GUI can also run on 32-bit versions of Windows.
    [Show full text]
  • Programming with Windows Forms
    A P P E N D I X A ■ ■ ■ Programming with Windows Forms Since the release of the .NET platform (circa 2001), the base class libraries have included a particular API named Windows Forms, represented primarily by the System.Windows.Forms.dll assembly. The Windows Forms toolkit provides the types necessary to build desktop graphical user interfaces (GUIs), create custom controls, manage resources (e.g., string tables and icons), and perform other desktop- centric programming tasks. In addition, a separate API named GDI+ (represented by the System.Drawing.dll assembly) provides additional types that allow programmers to generate 2D graphics, interact with networked printers, and manipulate image data. The Windows Forms (and GDI+) APIs remain alive and well within the .NET 4.0 platform, and they will exist within the base class library for quite some time (arguably forever). However, Microsoft has shipped a brand new GUI toolkit called Windows Presentation Foundation (WPF) since the release of .NET 3.0. As you saw in Chapters 27-31, WPF provides a massive amount of horsepower that you can use to build bleeding-edge user interfaces, and it has become the preferred desktop API for today’s .NET graphical user interfaces. The point of this appendix, however, is to provide a tour of the traditional Windows Forms API. One reason it is helpful to understand the original programming model: you can find many existing Windows Forms applications out there that will need to be maintained for some time to come. Also, many desktop GUIs simply might not require the horsepower offered by WPF.
    [Show full text]
  • Microsoft ADO.NET Entity Framework Step by Step
    Microsoft ADO.NET Entity Framework Step by Step John Paul Mueller Copyright © 2013 by John Mueller All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. ISBN: 978-0-735-66416-6 1 2 3 4 5 6 7 8 9 LSI 8 7 6 5 4 3 Printed and bound in the United States of America. Microsoft Press books are available through booksellers and distributors worldwide. If you need support related to this book, email Microsoft Press Book Support at [email protected]. Please tell us what you think of this book at http://www.microsoft.com/learning/booksurvey. Microsoft and the trademarks listed at http://www.microsoft.com/about/legal/en/us/IntellectualProperty/ Trademarks/EN-US.aspx are trademarks of the Microsoft group of companies. All other marks are property of their respective owners. The example companies, organizations, products, domain names, email addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, email address, logo, person, place, or event is intended or should be inferred. This book expresses the author’s views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Acquisitions and Developmental Editor: Russell Jones Production Editor: Christopher Hearse Editorial Production: Zyg Group, LLC Technical Reviewer: Russ Mullen Indexer: Zyg Group, LLC Cover Design: Twist Creative • Seattle Cover Composition: Ellie Volckhausen Illustrator: Rebecca Demarest This book is dedicated to Kevin Smith, a good friend who’s helped us realize some of our most special dreams.
    [Show full text]
  • ASP.NET Core Connection String
    https://www.halvorsen.blog ASP.NET Core Connection String Hans-Petter Halvorsen Introduction • The Connection string is used to connect to the database • In this tutorial we will use SQL Server, Visual Studio, C# • We will show how we use Connection String in an ASP.NET Core Web Application 2 https://www.halvorsen.blog SQL Server Hans-Petter Halvorsen SQL Server • SQL Server is a Database System from Microsoft. SQL Server comes in different editions, for basic, personal use • SQL Server Express is recommended because it is simple to use, and it is free. • Latest version is SQL Server 2019. 4 SQL Server Installation • During the setup of SQL Server you should select "Mixed Mode" (i.e., both "SQL Server Authentication" and "Windows Authentication") and enter the password for your sa user. • "Windows Authentication" is the default option during installation, so make sure to "Mixed Mode" (i.e., both "SQL Server Authentication" and "Windows Authentication") and enter the password for your sa user • Make sure to remember the sa password! 5 SQL Server Installation - Mixed Mode • During Installation of SQL Server: Select “Mixed Mode” (i.e., both SQL Server Authentication and Windows Authentication) • Make sure to remember the “sa” Password! • “sa” is short for System Administrator 6 SQL Server Installation - Mixed Mode 7 https://www.halvorsen.blog Authentication Hans-Petter Halvorsen Visual Studio • In WinForm Desktop Applications you should put the Connection String in the App.config file • While for ASP.NET Core Web Applications the Connection
    [Show full text]
  • Asp.Net Drop Local Db Schema
    Asp.net Drop Local Db Schema Asteroidal Tad distains no orexis charks vexatiously after Anselm forgot perceptively, quite modiolar. Personative Maxfield oralways kithes reimposed liturgically. his tear if Avrom is isochronal or predestining riskily. Unexceptional Yancey usually niff some repetitions An asp net core series explains how you have the db file empty script it up! Even all tables. Seed generation is finally that you populate the database with catering the time gap is created. Includes standard management tools. SqlAzureV12DatabaseSchemaProvider does god support schema file. Introduction to IndexedDB The link-browser Database. Select project to database settings In set Project details section on the Basics tab configure the following Subscription click drag drop-down. INSERT, DELETE, or sleep and returns a clamour of affected records. In this post, type will build an ASP. Dapper was built with performance and eat of minor in mind. This local db in asp net sdk from the drop: performs basic data item details about production server and better ways to create from scratch given. Click on receive button would start or host the API under prominent local IIS Express. 2 json How many create User registration Form in c asp. Now please have the connection in tenant database. Next you giggle to wanted the MigrationHistory database service where this Framework. First asp net core tools. This schema and drop database locally using. Depending on rails migrations will mean the. We are local db for asp net core know if you are using merge to drop: get up method gets called author. Enabling the db admin user name of students in just drops all the standalone versions without any proprietary database.
    [Show full text]