SlideShare a Scribd company logo
Copy data from table to another
ATP
Vocational Pedagogy
Student
202622013
Saleh Abalkhail
Application Development
Semester 6
Lecturer
Mohamed M.Elmaghawri
Copy data from table to another Vocational Pedagogy Application Development
1
Contents
Table of Figures.............................................................................................................................................2
Content Overview.........................................................................................................................................3
Specific Objectives ........................................................................................................................................3
Introduction ..................................................................................................................................................4
Data Grid View Definition .............................................................................................................................4
Database program used with visual studio...................................................................................................4
The tools for creating table in visual studio..................................................................................................4
Copy data from table to another..................................................................................................................5
Step 1: create new project in visual studio...............................................................................................5
Step 2: drag and drop two button and data grid view from toolbox into form .......................................5
Step 3: create database ............................................................................................................................6
Step 4: create table...................................................................................................................................7
Step 5: add data into table........................................................................................................................8
Step 6: add columns into table .................................................................................................................9
Step 7: write code for the table..............................................................................................................10
Step 8: import SQL library.......................................................................................................................11
Step 9: Write the SQL Connection ..........................................................................................................12
Step 10: write the code for buttons........................................................................................................12
Step 11: test the program.......................................................................................................................14
Conclusion...................................................................................................................................................14
References ..................................................................................................................................................15
Copy data from table to another Vocational Pedagogy Application Development
2
Table of Figures
Figure 1 Toolbox............................................................................................................................................4
Figure 2 create new project in visual studio.................................................................................................5
Figure 3 drag and drop two button and data grid view from toolbox into form..........................................5
Figure 4 create database...............................................................................................................................6
Figure 5 choose data Source.........................................................................................................................6
Figure 6 click Ok ............................................................................................................................................7
Figure 7 create table.....................................................................................................................................7
Figure 8 right table columns, table name, then click update .......................................................................8
Figure 9 open data view................................................................................................................................8
Figure 10 write data in the table...................................................................................................................9
Figure 11 add columns..................................................................................................................................9
Figure 12 uncheck checkbox.......................................................................................................................10
Figure 13 write code for the table ..............................................................................................................10
Figure 14 write the code.............................................................................................................................11
Figure 15 import SQL library.......................................................................................................................11
Figure 16 Write the SQL Connection ..........................................................................................................12
Figure 17 write the code for buttons..........................................................................................................12
Figure 18 The codes ....................................................................................................................................13
Figure 19 test the program .........................................................................................................................14
Copy data from table to another Vocational Pedagogy Application Development
3
Content Overview
• Data grid view.
• SQL commands.
• Fixed values.
Specific Objectives
By the end of the lesson the students will be able to:
LO1 Comprehend relation between Visual Studio and database.
LO2 Retrieve data from database using Select command.
LO3 Create data table in Visual Studio.
LO4 Copy data from table to another.
Copy data from table to another Vocational Pedagogy Application Development
4
Introduction
visual studio is a programming language which can be used to create application for windows operating
system, it is containing application tools such as button to do action when click on it, data grid view to
show data in table, all application tools can be drag and drop from toolbox in to forms.
Data Grid View Definition
The Data Grid View control provides a customizable table for displaying data. The Data Grid View class
allows customization of cells, rows, columns, and borders through the use of properties such as Default
Cell Style, Column Headers Default Cell Style, Cell Border Style, and Grid Color.
Database program used with visual studio
• Microsoft SQL server
• MYSQL
• PHP SQL
The tools for creating table in visual studio
• Button
• data grid view
• Form
Figure 1 Toolbox
Copy data from table to another Vocational Pedagogy Application Development
5
Copy data from table to another
Step 1: create new project in visual studio
Figure 2 create new project in visual studio
Open visual studio, next click on new project, next write any name, then click ok, Figure 2.
Step 2: drag and drop two button and data grid view from toolbox into form
Figure 3 drag and drop two button and data grid view from toolbox into form
Copy data from table to another Vocational Pedagogy Application Development
6
Step 3: create database
Figure 4 create database
Open server explorer toolbar, next right clicks on data connections, then click on add connection.
Figure 5 choose data Source
Copy data from table to another Vocational Pedagogy Application Development
7
Figure 6 click Ok
Step 4: create table
Figure 7 create table
Right click on table, next clicks on add new table
Copy data from table to another Vocational Pedagogy Application Development
8
Figure 8 right table columns, table name, then click update
Step 5: add data into table
Figure 9 open data view
Right click on table name, then click on show table data.
Copy data from table to another Vocational Pedagogy Application Development
9
Figure 10 write data in the table
Step 6: add columns into table
Figure 11 add columns
Copy data from table to another Vocational Pedagogy Application Development
10
Figure 12 uncheck checkbox
uncheck the adding, editing, deleting like in Figure 12.
Step 7: write code for the table
Figure 13 write code for the table
Right click on the table, next click on properties, then double click on mouse Click.
Copy data from table to another Vocational Pedagogy Application Development
11
Figure 14 write the code
Write the following code inside the brackets:
if ((bool)dataGridView1.SelectedRows[0].Cells[0].Value == false)
{
dataGridView1.SelectedRows[0].Cells[0].Value = true;
}
else
{
dataGridView1.SelectedRows[0].Cells[0].Value = false;
}
Step 8: import SQL library
Figure 15 import SQL library
Write the following code like in the Figure 15:
using System.Data.SqlClient;
Copy data from table to another Vocational Pedagogy Application Development
12
Step 9: Write the SQL Connection
Figure 16 Write the SQL Connection
Write the following code like in the Figure 16:
SqlConnection con = new SqlConnection(@"Data
Source=(LocalDB)MSSQLLocalDB;AttachDbFilename=C:UsersGansourcereposWindowsFormsApp1
WindowsFormsApp1transferData1.mdf;Integrated Security=True;Connect Timeout=30");
Step 10: write the code for buttons
Figure 17 write the code for buttons
Copy data from table to another Vocational Pedagogy Application Development
13
Figure 18 The codes
Double click on get Data button, then write the following code inside the brackets like in Figure 18:
SqlDataAdapter sda = new SqlDataAdapter("select * from informatiom", con);
DataTable dt = new DataTable();
sda.Fill(dt);
foreach (DataRow item in dt.Rows)
{
int n = dataGridView1.Rows.Add();
dataGridView1.Rows[n].Cells[0].Value = false;
dataGridView1.Rows[n].Cells[1].Value = item["Id"].ToString();
dataGridView1.Rows[n].Cells[2].Value = item["Name"].ToString();
}
Double click on copy button, then write the following code inside the brackets like in Figure 18:
dataGridView2.Rows.Clear();
foreach (DataGridViewRow item in dataGridView1.Rows)
{
if ((bool)item.Cells[0].Value == true)
{
int n = dataGridView2.Rows.Add();
dataGridView2.Rows[n].Cells[0].Value =
item.Cells[1].Value.ToString();
dataGridView2.Rows[n].Cells[1].Value =
item.Cells[2].Value.ToString();
}
}
Copy data from table to another Vocational Pedagogy Application Development
14
Step 11: test the program
Figure 19 test the program
Conclusion
To conclude, I have Introduce visual studio and the Data Grid View, I have explained the steps to copy
data from table into another through eleven steps, this project can be used to create application like
moves list, items list and employees list.
Copy data from table to another Vocational Pedagogy Application Development
15
References
Liberty, J. (2005). Programming C#: Building. NET Applications with C. " O'Reilly Media, Inc.".
Nagel, C., Evjen, B., Glynn, J., Skinner, M., & Watson, K. (2011). Professional C# 2008. John Wiley &
Sons.
Video: C# Copy Selected Rows in One Datagridview to another gridview
Retrieved from: https://www.youtube.com/watch?v=_iJuxh08TdQ
Date of access: 6/2/2018

More Related Content

What's hot

Office productivity tools (part ii) (2.74 mb)
Office productivity tools (part ii) (2.74 mb)Office productivity tools (part ii) (2.74 mb)
Office productivity tools (part ii) (2.74 mb)IMRAN KHAN
 
MICROSOFT ACCESS (ICTL)
MICROSOFT ACCESS (ICTL)MICROSOFT ACCESS (ICTL)
MICROSOFT ACCESS (ICTL)Nad0209
 
Saleena book (1)
Saleena book (1)Saleena book (1)
Saleena book (1)ANSARIARSH
 
Enterprise portal development cookbook
Enterprise portal development cookbookEnterprise portal development cookbook
Enterprise portal development cookbookAhmed Farag
 
Access lesson 01 Microsoft Access Basics
Access lesson 01 Microsoft Access BasicsAccess lesson 01 Microsoft Access Basics
Access lesson 01 Microsoft Access BasicsAram SE
 
Access lesson05
Access lesson05Access lesson05
Access lesson05Aram SE
 
Access2007 part1
Access2007 part1Access2007 part1
Access2007 part1jigeno
 
Excel2007 analysisservicescubespivottables
Excel2007 analysisservicescubespivottablesExcel2007 analysisservicescubespivottables
Excel2007 analysisservicescubespivottablesAnicet Dobe
 
computer-6th-primary-2nd-term (2)
computer-6th-primary-2nd-term (2)computer-6th-primary-2nd-term (2)
computer-6th-primary-2nd-term (2)khawagah
 
Access lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying FormsAccess lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying FormsAram SE
 
Access lesson 03 Creating Queries
Access lesson 03 Creating QueriesAccess lesson 03 Creating Queries
Access lesson 03 Creating QueriesAram SE
 
2017 Editable Thesis Checklist PDF
2017 Editable Thesis Checklist PDF2017 Editable Thesis Checklist PDF
2017 Editable Thesis Checklist PDFAtiqa khan
 
Access lesson 06 Integrating Access
Access lesson 06  Integrating AccessAccess lesson 06  Integrating Access
Access lesson 06 Integrating AccessAram SE
 

What's hot (18)

Ms office practical
Ms office practicalMs office practical
Ms office practical
 
Office productivity tools (part ii) (2.74 mb)
Office productivity tools (part ii) (2.74 mb)Office productivity tools (part ii) (2.74 mb)
Office productivity tools (part ii) (2.74 mb)
 
MICROSOFT ACCESS (ICTL)
MICROSOFT ACCESS (ICTL)MICROSOFT ACCESS (ICTL)
MICROSOFT ACCESS (ICTL)
 
Word2007p1
Word2007p1Word2007p1
Word2007p1
 
Saleena book (1)
Saleena book (1)Saleena book (1)
Saleena book (1)
 
Enterprise portal development cookbook
Enterprise portal development cookbookEnterprise portal development cookbook
Enterprise portal development cookbook
 
Access lesson 01 Microsoft Access Basics
Access lesson 01 Microsoft Access BasicsAccess lesson 01 Microsoft Access Basics
Access lesson 01 Microsoft Access Basics
 
Sq lite manager
Sq lite managerSq lite manager
Sq lite manager
 
Access lesson05
Access lesson05Access lesson05
Access lesson05
 
Access p3
Access p3Access p3
Access p3
 
Access2007 part1
Access2007 part1Access2007 part1
Access2007 part1
 
Excel2007 analysisservicescubespivottables
Excel2007 analysisservicescubespivottablesExcel2007 analysisservicescubespivottables
Excel2007 analysisservicescubespivottables
 
computer-6th-primary-2nd-term (2)
computer-6th-primary-2nd-term (2)computer-6th-primary-2nd-term (2)
computer-6th-primary-2nd-term (2)
 
Access lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying FormsAccess lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying Forms
 
Excel tutorial
Excel tutorialExcel tutorial
Excel tutorial
 
Access lesson 03 Creating Queries
Access lesson 03 Creating QueriesAccess lesson 03 Creating Queries
Access lesson 03 Creating Queries
 
2017 Editable Thesis Checklist PDF
2017 Editable Thesis Checklist PDF2017 Editable Thesis Checklist PDF
2017 Editable Thesis Checklist PDF
 
Access lesson 06 Integrating Access
Access lesson 06  Integrating AccessAccess lesson 06  Integrating Access
Access lesson 06 Integrating Access
 

Similar to Copy data from table to another report

DSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BI
DSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BI
DSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIEzekielJames8
 
Sql server 2012 tutorials reporting services
Sql server 2012 tutorials   reporting servicesSql server 2012 tutorials   reporting services
Sql server 2012 tutorials reporting servicesSteve Xu
 
Informatica complex transformation i
Informatica complex transformation iInformatica complex transformation i
Informatica complex transformation iAmit Sharma
 
2015 Luminant Energy Process Guide
2015 Luminant Energy Process Guide2015 Luminant Energy Process Guide
2015 Luminant Energy Process GuideKelly Stark
 
Oracle application express ppt
Oracle application express pptOracle application express ppt
Oracle application express pptAbhinaw Kumar
 
Sas visual analytics Training
Sas visual analytics Training Sas visual analytics Training
Sas visual analytics Training bidwhm
 
Oracle application express
Oracle application expressOracle application express
Oracle application expressAbhinaw Kumar
 
HARJOT.ppt
HARJOT.pptHARJOT.ppt
HARJOT.pptsatgup78
 
open project tool
open project toolopen project tool
open project toolNgu Khine
 
Tableau Course Content.docx
Tableau Course Content.docxTableau Course Content.docx
Tableau Course Content.docxLeotrainings
 
4 crear formularios training presentation create forms for a new database-1
4 crear formularios training presentation   create forms for a new database-14 crear formularios training presentation   create forms for a new database-1
4 crear formularios training presentation create forms for a new database-1Aula Cloud
 
2 crear formularios training presentation - create forms for a new database
2 crear formularios   training presentation - create forms for a new database2 crear formularios   training presentation - create forms for a new database
2 crear formularios training presentation - create forms for a new databaseAula Cloud
 
Informatica complex transformation ii
Informatica complex transformation iiInformatica complex transformation ii
Informatica complex transformation iiAmit Sharma
 
Smart view instructions_2_7_14
Smart view instructions_2_7_14Smart view instructions_2_7_14
Smart view instructions_2_7_14Sabyasachi Srimany
 
Powerpoint Tutorial
Powerpoint TutorialPowerpoint Tutorial
Powerpoint TutorialRon Thomson
 

Similar to Copy data from table to another report (20)

Dbi h315
Dbi h315Dbi h315
Dbi h315
 
DSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BI
DSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BI
DSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BIDSN_Power BI
 
Sql server 2012 tutorials analysis services tabular modeling
Sql server 2012 tutorials   analysis services tabular modelingSql server 2012 tutorials   analysis services tabular modeling
Sql server 2012 tutorials analysis services tabular modeling
 
Sql server 2012 tutorials reporting services
Sql server 2012 tutorials   reporting servicesSql server 2012 tutorials   reporting services
Sql server 2012 tutorials reporting services
 
Informatica complex transformation i
Informatica complex transformation iInformatica complex transformation i
Informatica complex transformation i
 
2015 Luminant Energy Process Guide
2015 Luminant Energy Process Guide2015 Luminant Energy Process Guide
2015 Luminant Energy Process Guide
 
Oracle application express ppt
Oracle application express pptOracle application express ppt
Oracle application express ppt
 
Sas visual analytics Training
Sas visual analytics Training Sas visual analytics Training
Sas visual analytics Training
 
Oracle application express
Oracle application expressOracle application express
Oracle application express
 
HARJOT.ppt
HARJOT.pptHARJOT.ppt
HARJOT.ppt
 
ssis lab
ssis labssis lab
ssis lab
 
open project tool
open project toolopen project tool
open project tool
 
Tableau Course Content.docx
Tableau Course Content.docxTableau Course Content.docx
Tableau Course Content.docx
 
4 crear formularios training presentation create forms for a new database-1
4 crear formularios training presentation   create forms for a new database-14 crear formularios training presentation   create forms for a new database-1
4 crear formularios training presentation create forms for a new database-1
 
2 crear formularios training presentation - create forms for a new database
2 crear formularios   training presentation - create forms for a new database2 crear formularios   training presentation - create forms for a new database
2 crear formularios training presentation - create forms for a new database
 
9505 (1).doc
9505 (1).doc9505 (1).doc
9505 (1).doc
 
Informatica complex transformation ii
Informatica complex transformation iiInformatica complex transformation ii
Informatica complex transformation ii
 
Nota ms access 2007
Nota ms access 2007Nota ms access 2007
Nota ms access 2007
 
Smart view instructions_2_7_14
Smart view instructions_2_7_14Smart view instructions_2_7_14
Smart view instructions_2_7_14
 
Powerpoint Tutorial
Powerpoint TutorialPowerpoint Tutorial
Powerpoint Tutorial
 

More from SalehShare

Unit 4 final - version
Unit 4   final - versionUnit 4   final - version
Unit 4 final - versionSalehShare
 
Unit 3 final 2
Unit 3   final 2Unit 3   final 2
Unit 3 final 2SalehShare
 
Unit 2 adolescence and disruptions-gavin
Unit 2 adolescence and disruptions-gavinUnit 2 adolescence and disruptions-gavin
Unit 2 adolescence and disruptions-gavinSalehShare
 
Differntiation reading
Differntiation readingDifferntiation reading
Differntiation readingSalehShare
 
Lesson plan template
Lesson plan templateLesson plan template
Lesson plan templateSalehShare
 
Copy data from table to another
Copy data from table to anotherCopy data from table to another
Copy data from table to anotherSalehShare
 

More from SalehShare (9)

Unit 4 final - version
Unit 4   final - versionUnit 4   final - version
Unit 4 final - version
 
Unit 3 final 2
Unit 3   final 2Unit 3   final 2
Unit 3 final 2
 
Survey report
Survey reportSurvey report
Survey report
 
Unit 2 adolescence and disruptions-gavin
Unit 2 adolescence and disruptions-gavinUnit 2 adolescence and disruptions-gavin
Unit 2 adolescence and disruptions-gavin
 
Unit 2 report
Unit 2 reportUnit 2 report
Unit 2 report
 
Differntiation reading
Differntiation readingDifferntiation reading
Differntiation reading
 
Unit 1 report
Unit 1 reportUnit 1 report
Unit 1 report
 
Lesson plan template
Lesson plan templateLesson plan template
Lesson plan template
 
Copy data from table to another
Copy data from table to anotherCopy data from table to another
Copy data from table to another
 

Recently uploaded

Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya - UEM Kolkata Quiz Club
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxakshayaramakrishnan21
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resourcesdimpy50
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...Sayali Powar
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringDenish Jangid
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTechSoup
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...Denish Jangid
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfVivekanand Anglo Vedic Academy
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePedroFerreira53928
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxbennyroshan06
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesRased Khan
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptxmansk2
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxJenilouCasareno
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfbu07226
 

Recently uploaded (20)

Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 

Copy data from table to another report

  • 1. Copy data from table to another ATP Vocational Pedagogy Student 202622013 Saleh Abalkhail Application Development Semester 6 Lecturer Mohamed M.Elmaghawri
  • 2. Copy data from table to another Vocational Pedagogy Application Development 1 Contents Table of Figures.............................................................................................................................................2 Content Overview.........................................................................................................................................3 Specific Objectives ........................................................................................................................................3 Introduction ..................................................................................................................................................4 Data Grid View Definition .............................................................................................................................4 Database program used with visual studio...................................................................................................4 The tools for creating table in visual studio..................................................................................................4 Copy data from table to another..................................................................................................................5 Step 1: create new project in visual studio...............................................................................................5 Step 2: drag and drop two button and data grid view from toolbox into form .......................................5 Step 3: create database ............................................................................................................................6 Step 4: create table...................................................................................................................................7 Step 5: add data into table........................................................................................................................8 Step 6: add columns into table .................................................................................................................9 Step 7: write code for the table..............................................................................................................10 Step 8: import SQL library.......................................................................................................................11 Step 9: Write the SQL Connection ..........................................................................................................12 Step 10: write the code for buttons........................................................................................................12 Step 11: test the program.......................................................................................................................14 Conclusion...................................................................................................................................................14 References ..................................................................................................................................................15
  • 3. Copy data from table to another Vocational Pedagogy Application Development 2 Table of Figures Figure 1 Toolbox............................................................................................................................................4 Figure 2 create new project in visual studio.................................................................................................5 Figure 3 drag and drop two button and data grid view from toolbox into form..........................................5 Figure 4 create database...............................................................................................................................6 Figure 5 choose data Source.........................................................................................................................6 Figure 6 click Ok ............................................................................................................................................7 Figure 7 create table.....................................................................................................................................7 Figure 8 right table columns, table name, then click update .......................................................................8 Figure 9 open data view................................................................................................................................8 Figure 10 write data in the table...................................................................................................................9 Figure 11 add columns..................................................................................................................................9 Figure 12 uncheck checkbox.......................................................................................................................10 Figure 13 write code for the table ..............................................................................................................10 Figure 14 write the code.............................................................................................................................11 Figure 15 import SQL library.......................................................................................................................11 Figure 16 Write the SQL Connection ..........................................................................................................12 Figure 17 write the code for buttons..........................................................................................................12 Figure 18 The codes ....................................................................................................................................13 Figure 19 test the program .........................................................................................................................14
  • 4. Copy data from table to another Vocational Pedagogy Application Development 3 Content Overview • Data grid view. • SQL commands. • Fixed values. Specific Objectives By the end of the lesson the students will be able to: LO1 Comprehend relation between Visual Studio and database. LO2 Retrieve data from database using Select command. LO3 Create data table in Visual Studio. LO4 Copy data from table to another.
  • 5. Copy data from table to another Vocational Pedagogy Application Development 4 Introduction visual studio is a programming language which can be used to create application for windows operating system, it is containing application tools such as button to do action when click on it, data grid view to show data in table, all application tools can be drag and drop from toolbox in to forms. Data Grid View Definition The Data Grid View control provides a customizable table for displaying data. The Data Grid View class allows customization of cells, rows, columns, and borders through the use of properties such as Default Cell Style, Column Headers Default Cell Style, Cell Border Style, and Grid Color. Database program used with visual studio • Microsoft SQL server • MYSQL • PHP SQL The tools for creating table in visual studio • Button • data grid view • Form Figure 1 Toolbox
  • 6. Copy data from table to another Vocational Pedagogy Application Development 5 Copy data from table to another Step 1: create new project in visual studio Figure 2 create new project in visual studio Open visual studio, next click on new project, next write any name, then click ok, Figure 2. Step 2: drag and drop two button and data grid view from toolbox into form Figure 3 drag and drop two button and data grid view from toolbox into form
  • 7. Copy data from table to another Vocational Pedagogy Application Development 6 Step 3: create database Figure 4 create database Open server explorer toolbar, next right clicks on data connections, then click on add connection. Figure 5 choose data Source
  • 8. Copy data from table to another Vocational Pedagogy Application Development 7 Figure 6 click Ok Step 4: create table Figure 7 create table Right click on table, next clicks on add new table
  • 9. Copy data from table to another Vocational Pedagogy Application Development 8 Figure 8 right table columns, table name, then click update Step 5: add data into table Figure 9 open data view Right click on table name, then click on show table data.
  • 10. Copy data from table to another Vocational Pedagogy Application Development 9 Figure 10 write data in the table Step 6: add columns into table Figure 11 add columns
  • 11. Copy data from table to another Vocational Pedagogy Application Development 10 Figure 12 uncheck checkbox uncheck the adding, editing, deleting like in Figure 12. Step 7: write code for the table Figure 13 write code for the table Right click on the table, next click on properties, then double click on mouse Click.
  • 12. Copy data from table to another Vocational Pedagogy Application Development 11 Figure 14 write the code Write the following code inside the brackets: if ((bool)dataGridView1.SelectedRows[0].Cells[0].Value == false) { dataGridView1.SelectedRows[0].Cells[0].Value = true; } else { dataGridView1.SelectedRows[0].Cells[0].Value = false; } Step 8: import SQL library Figure 15 import SQL library Write the following code like in the Figure 15: using System.Data.SqlClient;
  • 13. Copy data from table to another Vocational Pedagogy Application Development 12 Step 9: Write the SQL Connection Figure 16 Write the SQL Connection Write the following code like in the Figure 16: SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)MSSQLLocalDB;AttachDbFilename=C:UsersGansourcereposWindowsFormsApp1 WindowsFormsApp1transferData1.mdf;Integrated Security=True;Connect Timeout=30"); Step 10: write the code for buttons Figure 17 write the code for buttons
  • 14. Copy data from table to another Vocational Pedagogy Application Development 13 Figure 18 The codes Double click on get Data button, then write the following code inside the brackets like in Figure 18: SqlDataAdapter sda = new SqlDataAdapter("select * from informatiom", con); DataTable dt = new DataTable(); sda.Fill(dt); foreach (DataRow item in dt.Rows) { int n = dataGridView1.Rows.Add(); dataGridView1.Rows[n].Cells[0].Value = false; dataGridView1.Rows[n].Cells[1].Value = item["Id"].ToString(); dataGridView1.Rows[n].Cells[2].Value = item["Name"].ToString(); } Double click on copy button, then write the following code inside the brackets like in Figure 18: dataGridView2.Rows.Clear(); foreach (DataGridViewRow item in dataGridView1.Rows) { if ((bool)item.Cells[0].Value == true) { int n = dataGridView2.Rows.Add(); dataGridView2.Rows[n].Cells[0].Value = item.Cells[1].Value.ToString(); dataGridView2.Rows[n].Cells[1].Value = item.Cells[2].Value.ToString(); } }
  • 15. Copy data from table to another Vocational Pedagogy Application Development 14 Step 11: test the program Figure 19 test the program Conclusion To conclude, I have Introduce visual studio and the Data Grid View, I have explained the steps to copy data from table into another through eleven steps, this project can be used to create application like moves list, items list and employees list.
  • 16. Copy data from table to another Vocational Pedagogy Application Development 15 References Liberty, J. (2005). Programming C#: Building. NET Applications with C. " O'Reilly Media, Inc.". Nagel, C., Evjen, B., Glynn, J., Skinner, M., & Watson, K. (2011). Professional C# 2008. John Wiley & Sons. Video: C# Copy Selected Rows in One Datagridview to another gridview Retrieved from: https://www.youtube.com/watch?v=_iJuxh08TdQ Date of access: 6/2/2018