Download presentation
Presentation is loading. Please wait.
Published byRebecca Washington Modified over 8 years ago
1
Creating SQL Database file And Displaying a Database Table in a DataGridView
2
Create new windows application project
3
Click on add new data source option in data source window
4
In choose data source type dialog box select Dataset then click next
5
In choose your data connection dialog box click on new connection button
6
Select Microsoft SQL Server Database file option as a data source then click on continue button
7
In Add connection dialog box enter a name for the database file ex: database1 then click on ok button
9
A massage box will appear to tell you that this is a new database would you like to create it? Click on yes button
10
Now a new database is created with a specific connection string that will be used to connect the application to this database.
11
Click next
12
Click on NO button
13
Click on next
14
Click on previous button
15
Click on finish button
17
Open server explorer then click on database1.mdf then right click on Tables and choose Add new Table option
19
Add new filed "name" to the table as following
20
To save changes on the table click on update then Click on update database button
22
To change table name to "student"
23
Update the database then close the table
24
On data source window right click on database1Dataset then choose Configure data source with wizard then choose tables
25
Then choose table click finish
27
Drag and drop student table from data source window to the form
28
Run the program
29
Add new record then click save
30
Remove the record then click save
31
How Data Binding Works The technique through which GUI controls are connected to data sources is known as data binding. The IDE allows controls, such as a DataGridView, to be bound to a data source, such as a DataSet that represents a table in a database. Any changes you make through the application to the underlying data source will automatically be reflected in the way the data is presented in the data-bound control (e.g., the DataGridView). Likewise, modifying the data in the data-bound control and saving the changes updates the underlying data source.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.