Visual Basic.NET Data Entry Professor Ralph Westfall April 2011.

Slides:



Advertisements
Similar presentations
MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
Advertisements

Stored procedures and views You can see definitions for stored procedures and views in the demo databases but you can’t change them. For views, expand.
Benchmark Series Microsoft Access 2010 Level 1
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Chapter 14.3 LINQ to SQL Programming in Visual Basic 2010: The Very Beginner’s Guide by Jim McKeown Databases – Part 3.
Chapter 18 - Data sources and datasets 1 Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Microsoft Office 2010 Access Chapter 1 Creating and Using a Database.
Access - Project 1 l What Is a Database? –A Collection of Data –Organized in a manner to allow: »Access »Retrieval »Use of That Data.
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
Creating And Maintaining A Database. 2 Learn the guidelines for designing databases When designing a database, first try to think of all the fields of.
Microsoft Visual Basic 2012 CHAPTER TEN Incorporating Databases with ADO.NET.
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
Stored Procedures Dr. Ralph D. Westfall May, 2009.
Microsoft Visual Basic 2005 CHAPTER 12 Cell Phone Applications and Web Services.
Introduction to Access By Mary Ann Chaney and Alicia Harkleroad.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
CIS 338: Creating ActiveX Controls Dr. Ralph D. Westfall March, 2003.
ASP.NET Web Application Professor Ralph Westfall May 2011.
ICP Kit 2011 HHC Data Entry Module The World Bank ICP Kit Training African Development Bank.
Chapter 1 Databases and Database Objects: An Introduction
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Copyright 2007, Information Builders. Slide 1 WebFOCUS Maintain – Enhancing Objects with JavaScript Mark Derwin Information Builders Information Builders.
Creating a Web Site to Gather Data and Conduct Research.
Microsoft Access Get a green book. Page AC 2 Define Access Define database.
Microsoft Access Data Base Application. A Few Terms Database – A collection of related information. Database – A collection of related information. Field.
XP New Perspectives on Integrating Microsoft Office XP Tutorial 2 1 Integrating Microsoft Office XP Tutorial 2 – Integrating Word, Excel, and Access.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
1 Working with MS SQL Server Textbook Chapter 14.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with MSSQL Server Code:G0-C# Version: 1.0 Author: Pham Trung Hai CTD.
Lesson 17 Getting Started with Access Essentials
1 By: Nour Hilal. Microsoft Access is a database software where data is stored in one or more Tables. A Database is a group of related Tables. Access.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 5 Enhancing Forms with OLE Fields, Hyperlinks, and Subforms.
XP New Perspectives on Microsoft Access 2002 Tutorial 21 Microsoft Access Tutorial 2 – Creating And Maintaining A Database.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
Unit 8.3 Learning Objectives Insert users into the ASP.NET Membership system from code Capture data being sent to the database Capture Exceptions that.
CIS 338: Using Queries in Access as a RecordSource Dr. Ralph D. Westfall May, 2011.
Chapter 17 Creating a Database.
Microsoft Visual Basic 2008 CHAPTER TWELVE Cell Phone Applications and Web Services.
CSC 240 (Blum)1 Forms and Importing Data in Access.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Access Project 7 Advanced Report and Form Techniques.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
1 Chapter 20 – Data sources and datasets Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Ch. 101 Database Management An Introduction to Databases.
Fall 2003Sylnovie Merchant, Ph.D. ACCESS Tutorial Note: The purpose of this tutorial is to provide an introduction to some of the functions of ACCESS in.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
Normalizing Database Files Professor Ralph Westfall May, 2011.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Editing and Designing Databases.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Access Project 2 Querying a Database Using the Select Query Window.
VB.NET and Databases. ADO.NET VB.Net allows you many ways to connect to a database. The technology used to interact with a database or data source is.
1 Working with MS SQL Server Beginning ASP.NET in C# and VB Chapter 12.
CIS 338: VB.NET Printing Dr. Ralph D. Westfall May, 2011.
COMPUTER SKILLS MS-ACCESS. Introduction Access is a piece of software known as a database management system. At its most basic level, it can be used to.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
Visual Studio 2010 Hello World CSC 230.
Stored Procedures Dr. Ralph D. Westfall May, 2011.
GO! with Microsoft Office 2016
Incorporating Databases with ADO.NET
GO! with Microsoft Access 2016
Incorporating Databases with ADO.NET
Visual Studio 2010 Hello World CSC 230.
MODULE 7 Microsoft Access 2010
CIS16 Application Programming with Visual Basic
Microsoft Office Access 2003
Presentation transcript:

Visual Basic.NET Data Entry Professor Ralph Westfall April 2011

Create a SQL Server Database Can download database files to C:\cis338, then skip to Create Visual Basic Project slide: Nations.mdf, Nations_log.ldf Nations.mdfNations_log.ldf Start>All Programs>Microsoft SQL Server 2008>SQL Server Management Studio>OK  Be sure Windows Authentication is being used, write down the Server name:>click Connect Expand server name in Object Explorer window on lower left  right-click Databases>New Database>type Nations as Database name:>OK

Import Data Data file for creating database: nations.csvnations.csv  See Saving Changes Not Permitted if have problems saving the fileSaving Changes Not Permitted Right-click Nations (database name)> Tasks>Import Data>Next>  select Flat File Source>Browse and select Files of type: CSV files (*.csv) to get nations.csv>select Format: Delimited>Next>  use Excel to fix bad data and then restart import  Next (Use Windows authentication)>Next>Next> Next>Finish> Close

Add ID Field Expand Databases, Nations, Tables, nations in Object Explorer  Right-click dbo.nations>Design>right-click Column Name in top row>Insert Column  Right-click the new column>Set Primary Key  Go down to Column Properties tab, expand Identity Specification, set (Is Identity) to Yes, set Identity Seed to a value that will not require extra digits to handle all expected growth i.e., if there never will be more than 898 records, set the initial seed be 101 (1001 for < 8998, etc.)

Modify Fields Change field names and properties:  New top row should be named ID with datatype of int (don't allow missing values; must have!)  Next row should be named Country with Data Type of varchar(20)‏  Next three rows should be Gold, Silver, Bronze, each with Data Type of int  Next row should be Pop, with Data Type of decimal(7, 2)‏  Next two rows should be Capital and Currency (can leave fields at 50 characters wide) File>Save Nations>Yes (ignore warnings)‏

Detach Database Right-click database name (not table name) in Object Explorer>Facets>select and copy PrimaryFilePath>OK Open File Explorer and paste that path into address box Close the Design window on the right of Management studio Right-click Nations>Tasks>Detach>check Drop Connections>OK Close Management Studio

Move SQL Server Database Select and Cut nations.mdf and nations_log.ldf files in Windows Explorer Paste the files into a directory named C:\cis338

Create Visual Basic.NET Project Go into SQL Server Management Studio and Attach database at new location Start>All Programs>Microsoft Visual Studio 2008 (or 2010) Click Project link after Create: on left side  Expand Visual Basic>click Windows>Windows Forms Application>rename as DataEntry> OK Right-click Form1 in designer window> Properties  Change (Name) to frmDataEntry  Change Text to Data Entry

Data Connection File> Save All > browse to Desktop (or somewhere else you can find it) >Save Data > Add New Datasource > Database > Next>New Connection > Microsoft SQL Server > paste (local)\SQLEXPRESS > Continue > Attach a Database file > Browse>(select Nations.mdf) > Test Connection > OK > OK > Next > No (don't save connection string) > Next > expand Tables and select nations > Finish (if skip, may not work)  If fails after Test Connection, start over on this or start new VB project and try again (waiting helps?)

Add Database – Multiple Server If working with more than one database, use the following sequence Data>Add New Datasource>Database> Next>New Connection>, select server name)>Select or enter etc.>Browse to/select (file name)>click Test ConnectionOpen>OK>Next>No (don't move)>Next>expand Tables and select nations>Finish

Add Controls (in VS) Data>Show Data Sources>expand NationsDataSet>click nations>click drop down>select Details>drag nations onto form Unselect other TextBoxes, set Enabled Property of ID TextBox to False Enabled Property of CountryTextBox should be True, set Multiline=True  Expand so it can show two lines  WordWrap should be True also Move Labels and Textboxes to adjust layout  Enlarge form, move items as necessary Make textbox widths correspond to number of characters they will hold (narrower for few)

Add BindingNavigator Button Click the ListBox on the NationsBindingNavigator and select Separator Click it again and select Button  Change the DisplayStyle property to Text  Set the Text Property to Exit  Double-click it and type close in the new Sub

Modify the Query Need to modify because data isn't sorted, making it difficult to edit In tray below form, right-click NationsTableAdapter>Edit Queries in DataSet Designer  Right-click Fill,GetData() at bottom of nations window>Configure  Add ORDER BY Country to bottom of query (or use Query Builder to set sorting)>Finish Run code to verify that there are no syntax errors and data is sorted

Add a "Pick List" Add a ComboBox to the form with the (Name) of cboCurrency, and a Label that says Alternate Currency  In the Properties for the ComboBox, click to the right of (Collection) in the Items line and type Dollar, Euro, Other, Pound, Yen on separate lines  Set the Sorted Property as True Click inside the ComboBox to create a Sub  Put the following line of code in the Sub CurrencyTextBox.Text = cboCurrency.SelectedItem.ToString

Testing Run the Project  Use the ComboBox to change currency values  Add values with the + sign button, delete with the red X, save by clicking the diskette icon  Click Exit to stop the project and then start it again and verify the changes  Will crash if you didn't put a primary key on the database table!//  Will crash if data is too wide for database fields e.g., input a Country with more than 25 characters