Submit Search
Upload
C# Tutorial MSM_Murach chapter-18-slides
•
Download as PPT, PDF
•
1 like
•
411 views
S
Sami Mut
Follow
Murach chapter- 18- slides
Read less
Read more
Technology
Report
Share
Report
Share
1 of 39
Download now
Recommended
C# Tutorial MSM_Murach chapter-24-slides
C# Tutorial MSM_Murach chapter-24-slides
Sami Mut
C# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slides
Sami Mut
C# Tutorial MSM_Murach chapter-14-slides
C# Tutorial MSM_Murach chapter-14-slides
Sami Mut
C# Tutorial MSM_Murach chapter-05-slides
C# Tutorial MSM_Murach chapter-05-slides
Sami Mut
C# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slides
Sami Mut
C# Tutorial MSM_Murach chapter-25-slides
C# Tutorial MSM_Murach chapter-25-slides
Sami Mut
C# Tutorial MSM_Murach chapter-07-slides
C# Tutorial MSM_Murach chapter-07-slides
Sami Mut
C# Tutorial MSM_Murach chapter-06-slides
C# Tutorial MSM_Murach chapter-06-slides
Sami Mut
Recommended
C# Tutorial MSM_Murach chapter-24-slides
C# Tutorial MSM_Murach chapter-24-slides
Sami Mut
C# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slides
Sami Mut
C# Tutorial MSM_Murach chapter-14-slides
C# Tutorial MSM_Murach chapter-14-slides
Sami Mut
C# Tutorial MSM_Murach chapter-05-slides
C# Tutorial MSM_Murach chapter-05-slides
Sami Mut
C# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slides
Sami Mut
C# Tutorial MSM_Murach chapter-25-slides
C# Tutorial MSM_Murach chapter-25-slides
Sami Mut
C# Tutorial MSM_Murach chapter-07-slides
C# Tutorial MSM_Murach chapter-07-slides
Sami Mut
C# Tutorial MSM_Murach chapter-06-slides
C# Tutorial MSM_Murach chapter-06-slides
Sami Mut
C# Tutorial MSM_Murach chapter-12-slides
C# Tutorial MSM_Murach chapter-12-slides
Sami Mut
C# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slides
Sami Mut
C# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slides
Sami Mut
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slides
Sami Mut
C# Tutorial MSM_Murach chapter-13-slides
C# Tutorial MSM_Murach chapter-13-slides
Sami Mut
C# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slides
Sami Mut
C# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-19-slides
Sami Mut
C# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slides
Sami Mut
C# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-09-slides
Sami Mut
C# Tutorial MSM_Murach chapter-15-slides
C# Tutorial MSM_Murach chapter-15-slides
Sami Mut
C# Tutorial MSM_Murach chapter-16-slides
C# Tutorial MSM_Murach chapter-16-slides
Sami Mut
C# Tutorial MSM_Murach chapter-11-slides
C# Tutorial MSM_Murach chapter-11-slides
Sami Mut
C# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slides
Sami Mut
C# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slides
Sami Mut
Intake 38 8
Intake 38 8
Mahmoud Ouf
Intake 38 9
Intake 38 9
Mahmoud Ouf
Intake 37 9
Intake 37 9
Mahmoud Ouf
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Design
francopw
Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding
francopw
Chapter 04
Chapter 04
llmeade
C# Tutorial MSM_Murach chapter-23-slides
C# Tutorial MSM_Murach chapter-23-slides
Sami Mut
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
lorinerba
More Related Content
What's hot
C# Tutorial MSM_Murach chapter-12-slides
C# Tutorial MSM_Murach chapter-12-slides
Sami Mut
C# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slides
Sami Mut
C# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slides
Sami Mut
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slides
Sami Mut
C# Tutorial MSM_Murach chapter-13-slides
C# Tutorial MSM_Murach chapter-13-slides
Sami Mut
C# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slides
Sami Mut
C# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-19-slides
Sami Mut
C# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slides
Sami Mut
C# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-09-slides
Sami Mut
C# Tutorial MSM_Murach chapter-15-slides
C# Tutorial MSM_Murach chapter-15-slides
Sami Mut
C# Tutorial MSM_Murach chapter-16-slides
C# Tutorial MSM_Murach chapter-16-slides
Sami Mut
C# Tutorial MSM_Murach chapter-11-slides
C# Tutorial MSM_Murach chapter-11-slides
Sami Mut
C# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slides
Sami Mut
C# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slides
Sami Mut
Intake 38 8
Intake 38 8
Mahmoud Ouf
Intake 38 9
Intake 38 9
Mahmoud Ouf
Intake 37 9
Intake 37 9
Mahmoud Ouf
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Design
francopw
Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding
francopw
Chapter 04
Chapter 04
llmeade
What's hot
(20)
C# Tutorial MSM_Murach chapter-12-slides
C# Tutorial MSM_Murach chapter-12-slides
C# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-13-slides
C# Tutorial MSM_Murach chapter-13-slides
C# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-15-slides
C# Tutorial MSM_Murach chapter-15-slides
C# Tutorial MSM_Murach chapter-16-slides
C# Tutorial MSM_Murach chapter-16-slides
C# Tutorial MSM_Murach chapter-11-slides
C# Tutorial MSM_Murach chapter-11-slides
C# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slides
Intake 38 8
Intake 38 8
Intake 38 9
Intake 38 9
Intake 37 9
Intake 37 9
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Design
Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding
Chapter 04
Chapter 04
Similar to C# Tutorial MSM_Murach chapter-18-slides
C# Tutorial MSM_Murach chapter-23-slides
C# Tutorial MSM_Murach chapter-23-slides
Sami Mut
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
lorinerba
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
dsgdfhdhfghfghfghfg
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
trishaavenell
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
lorinerba
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
zacherynicoloro
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
zacherynicoloro
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
lorinerba
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
lorinerba
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
dsgdfhdhfghfghfghfg
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
zacherynicoloro
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
lorinerba
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
zacherynicoloro
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
zacherynicoloro
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
dsgdfhdhfghfghfghfg
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
zacherynicoloro
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
zacherynicoloro
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
zacherynicoloro
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
zacherynicoloro
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
trishaavenell
Similar to C# Tutorial MSM_Murach chapter-18-slides
(20)
C# Tutorial MSM_Murach chapter-23-slides
C# Tutorial MSM_Murach chapter-23-slides
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
BIS 220 Final Exam 2015 version
More from Sami Mut
C# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slides
Sami Mut
MSM_Time
MSM_Time
Sami Mut
chapter 5 Java at rupp cambodia
chapter 5 Java at rupp cambodia
Sami Mut
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodia
Sami Mut
chapter 3 Java at rupp cambodia
chapter 3 Java at rupp cambodia
Sami Mut
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodia
Sami Mut
chapter 1 Java at rupp cambodia
chapter 1 Java at rupp cambodia
Sami Mut
More from Sami Mut
(7)
C# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slides
MSM_Time
MSM_Time
chapter 5 Java at rupp cambodia
chapter 5 Java at rupp cambodia
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodia
chapter 3 Java at rupp cambodia
chapter 3 Java at rupp cambodia
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodia
chapter 1 Java at rupp cambodia
chapter 1 Java at rupp cambodia
Recently uploaded
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
DianaGray10
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
The Digital Insurer
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Martijn de Jong
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Remote DBA Services
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
sudhanshuwaghmare1
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
UK Journal
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
jfdjdjcjdnsjd
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Juan lago vázquez
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
apidays
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Principled Technologies
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
Andrey Devyatkin
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
SynarionITSolutions
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
apidays
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
apidays
Recently uploaded
(20)
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
C# Tutorial MSM_Murach chapter-18-slides
1.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 1 Chapter 18 How to work with data sources and datasets
2.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 2 Objectives Applied 1. Use a data source to get the data that an application requires. 2. Use a DataGridView control to present the data that’s retrieved by a data source. 3. Use other controls like text boxes to present the data that’s retrieved by a data source. 4. Write the code for handling any data errors that result from the use of the data source or the controls that are bound to it. 5. Use the Dataset Designer to (1) view the schema for the dataset of a data source, (2) modify a query using the Query Builder, (3) preview the data for a query, or (4) review the SQL statements that are generated for a data source.
3.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 3 Objectives (continued) Knowledge 1. Describe the use of a connection string in an app.config file. 2. Describe the use of the Fill method of the TableAdapter object and the UpdateAll method of the TableAdapterManager object. 3. Describe the use of the EndEdit method of the BindingSource object. 4. Describe the two categories of data errors that can occur when you run an application that uses a data source. 5. Describe the use of the DataError event for a DataGridView control. 6. In general terms, describe the way the SQL statements that are generated for a data source (1) prevent concurrency errors and (2) refresh a dataset when the database generates the keys for new rows.
4.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 4 An empty Data Sources window
5.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 5 A Data Sources window after a data source has been added
6.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 6 The first step of the Data Source Wizard
7.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 7 The second step of the Wizard
8.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 8 The third step of the Wizard
9.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 9 The Add Connection dialog box
10.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 10 The Change Data Source dialog box
11.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 11 The fourth step of the Wizard
12.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 12 The information that’s stored in the app.config file <connectionStrings> <add name="ProductMaintenance.Properties.Settings. MMABooksConnectionString" connectionString="Data Source=localhostsqlexpress; Initial Catalog=MMABooks; Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings>
13.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 13 The last step of the Wizard
14.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 14 How to work with columns that have default values • Omit columns with default values from the dataset unless they’re needed by the application. • Provide values for those columns whenever a row is added to the dataset.
15.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 15 A project with a dataset defined by a data source
16.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 16 A form with the Products table dragged onto it
17.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 17 The controls and objects that are created when you drag a data source to a form • DataGridView control • BindingNavigator control • BindingSource object • DataSet object • TableAdapter object • TableAdapterManager object
18.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 18 The user interface for the Product Maintenance application
19.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 19 The code that’s generated by Visual Studio private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the // 'mMABooksDataSet.Products' table. // You can move, or remove it, as needed. this.productsTableAdapter.Fill( this.mMABooksDataSet.Products); } private void productsBindingNavigatorSaveItem_Click( object sender, EventArgs e) { this.Validate(); this.productsBindingSource.EndEdit(); this.tableAdapterManager.UpdateAll( this.mMABooksDataSet); }
20.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 20 The syntax of the Fill method tableAdapter.Fill(dataSet.TableName) The syntax of the UpdateAll method tableAdapterManager.UpdateAll(dataSet)
21.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 21 How to change the default control for a data table
22.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 22 How to change the default control for a column in a data table
23.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 23 A form with the Customers table dragged onto it
24.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 24 The user interface for the Customer Maintenance application
25.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 25 The code for the application private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the // 'mMABooksDataSet.Customers' table. // You can move, or remove it, as needed. this.customersTableAdapter.Fill( this.mMABooksDataSet.Customers); } private void customersBindingNavigatorSaveItem_Click( object sender, EventArgs e) { this.Validate(); this.customersBindingSource.EndEdit(); this.tableAdapterManager.UpdateAll( this.mMABooksDataSet); }
26.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 26 .NET data provider exception classes • SqlException • OracleException • OdbcException • OleDbException
27.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 27 Common members of the .NET data provider exception classes • Number • Message • Source • Errors • GetType()
28.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 28 Code that catches a SQL exception private void Form1_Load(object sender, EventArgs e) { try { this.customersTableAdapter.Fill( this.mMABooksDataSet.Customers); } catch (SqlException ex) { MessageBox.Show("Database error # " + ex.Number + ": " + ex.Message, ex.GetType().ToString()); } }
29.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 29 Common ADO.NET exception classes • DBConcurrencyException • DataException • ConstraintException • NoNullAllowedException Common members of the ADO.NET classes • Message • GetType()
30.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 30 Code that handles ADO.NET errors try { this.customersBindingSource.EndEdit(); this.tableAdapterManager.UpdateAll(this.mMABooksDataSet); } catch (DBConcurrencyException) { MessageBox.Show("A concurrency error occurred. " + "Some rows were not updated.", "Concurrency Exception"); this.customersTableAdapter.Fill( this.mMABooksDataSet.Customers); } catch (DataException ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); customersBindingSource.CancelEdit(); }
31.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 31 Code that handles ADO.NET errors (cont.) catch (SqlException ex) { MessageBox.Show("Database error # " + ex.Number + ": " + ex.Message, ex.GetType().ToString()); }
32.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 32 An event of the DataGridView control • DataError Three properties of the DataGridViewDataErrorEventArgs class • Exception • RowIndex • ColumnIndex
33.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 33 Code that handles a data error for a DataGridView control private void productsDataGridView_DataError( object sender, DataGridViewDataErrorEventArgs e) { int row = e.RowIndex + 1; string errorMessage = "A data error occurred.n" + "Row: " + row + "n" + "Error: " + e.Exception.Message; MessageBox.Show(errorMessage, "Data Error"); }
34.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 34 The schema displayed in the Dataset Designer
35.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 35 The Query Builder
36.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 36 The Preview Data dialog box
37.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 37 SQL that retrieves customer rows SELECT CustomerID, Name, Address, City, State, ZipCode FROM Customers SQL that inserts a customer row and refreshes the dataset INSERT INTO Customers (Name, Address, City, State, ZipCode) VALUES (@Name, @Address, @City, @State, @ZipCode); SELECT CustomerID, Name, Address, City, State, ZipCode FROM Customers WHERE (CustomerID = SCOPE_IDENTITY())
38.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 38 SQL that updates a customer row and refreshes the dataset UPDATE Customers SET Name = @Name, Address = @Address, City = @City, State = @State, ZipCode = @ZipCode WHERE ( (CustomerID = @Original_CustomerID) AND (Name = @Original_Name) AND (Address = @Original_Address) AND (City = @Original_City) AND (State = @Original_State) AND (ZipCode = @Original_ZipCode) ); SELECT CustomerID, Name, Address, City, State, ZipCode FROM Customers WHERE (CustomerID = @CustomerID)
39.
Murach’s C# 2010,
C1 © 2010, Mike Murach & Associates, Inc. Slide 39 SQL that deletes a customer row DELETE FROM Customers WHERE (CustomerID = @Original_CustomerID) AND (Name = @Original_Name) AND (Address = @Original_Address) AND (City = @Original_City) AND (State = @Original_State) AND (ZipCode = @Original_ZipCode)
Download now