Part2 database connection service based using vb.net
Transcript of Part2 database connection service based using vb.net
![Page 1: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/1.jpg)
Part 2 – Database Connection in VB.NET using Service based database
Dr. Girija Narasimhan 1
![Page 2: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/2.jpg)
Step 1- creating Dataset PROJECT Add New Item Common Item Service based database dataset Finish
Media Descriptor File (.MDF) created
Dr. Girija Narasimhan 2
![Page 3: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/3.jpg)
In memory-representation of data, Get record of data from retrieved from a database, the data adapter creates a dataset and stores data in it. The connection with the database is closed “disconnected architecture” , it works as Virtual Database containing table rows and columns
Dr. Girija Narasimhan 3
![Page 4: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/4.jpg)
Click the finish button Dr. Girija Narasimhan 4
![Page 5: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/5.jpg)
Click the property of database1.mdf
Change “copy if newer” means it will copy the database from the project root only if you make some changes to the database an build your project
Each time run the application dbase is updated, the update are going to the copy instead of the original
Dr. Girija Narasimhan 5
![Page 6: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/6.jpg)
View-serverexplorer-right click .mdf ”add new table”
Dr. Girija Narasimhan 6
![Page 7: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/7.jpg)
Type Table name Step 2: Column name and datatype and size
Step 3: Press update Step 1
Table design
Dr. Girija Narasimhan 7
![Page 8: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/8.jpg)
Server explorerdatabase1.mdfemp1(table>right click select “show table data”
Dr. Girija Narasimhan 8
![Page 9: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/9.jpg)
Viewother windowsdata sourcesconfigure data source with wizard . Then only table column appear. Hint: data source is not visible when you are in dbo.table , it is visible only in form design, so go to form design and then select data source
Dr. Girija Narasimhan 9
![Page 10: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/10.jpg)
From data source -drag column and place it in form1 (any form)
Dr. Girija Narasimhan 10
![Page 11: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/11.jpg)
Click “app.config’”property in solution Explorer
Solution explorer : Copy from database1.mdf property full path and paste it in app.config “attachDbFilename”
Step 1
Step 2
Dr. Girija Narasimhan 11
![Page 12: Part2 database connection service based using vb.net](https://reader034.fdocuments.in/reader034/viewer/2022042716/55a5d7331a28abe6548b45a6/html5/thumbnails/12.jpg)
Summary of the Tutorial:
Step 1: ProjectAdd new itemcommon item service based database dataset solution explorer .MDF file right click property copy to output directory change as “copy if newer”
Step 2 :view server explorer Data connection .mdf right click add new table change table name assign column name press update Step 3: server explorer now created table appear in the under .mdf - right click “show table data” enter record values
Step 4 : In the form design view other windows select data sources database1dataset right click -select “configure data source with wizard” then table and column name appear drag columns and place it in form design
Step 5: In the solution explorer right click .mdf property copy the “full path” url information app.config right click the property paste the full path url in the connection string ”Attach DbFilename =“
Dr. Girija Narasimhan 12