View
151
Download
1
Category
Tags:
Preview:
Citation preview
Part 2 – Database Connection in VB.NET using Service based database
Dr. Girija Narasimhan 1
Step 1- creating Dataset PROJECT Add New Item Common Item Service based database dataset Finish
Media Descriptor File (.MDF) created
Dr. Girija Narasimhan 2
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
Click the finish button Dr. Girija Narasimhan 4
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
View-serverexplorer-right click .mdf ”add new table”
Dr. Girija Narasimhan 6
Type Table name Step 2: Column name and datatype and size
Step 3: Press update Step 1
Table design
Dr. Girija Narasimhan 7
Server explorerdatabase1.mdfemp1(table>right click select “show table data”
Dr. Girija Narasimhan 8
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
From data source -drag column and place it in form1 (any form)
Dr. Girija Narasimhan 10
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
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
Recommended