How to create database & tables ?? SQL-create Database & Table
==================================================================================
Before going to do any Database Program ,Click here to understand Database Concepts thoroughly.
That is , Creating Database within VB Platform
==================================================================================
(A) Creating a database :
Creating a database using Access(97) and creating a table.
Steps For crating Database in Access :
==================================================================================
Before going to do any Database Program ,Click here to understand Database Concepts thoroughly.
That is , Creating Database within VB Platform
==================================================================================
(A) Creating a database :
Creating a database using Access(97) and creating a table.
- Open Access, select Blank Database, then OK
- Give a name (say db1) , then click Create
- Select create table in Design View from the dialog window, and OK
- Now we will get a window showing three fields a s Field Name,Data Type and Description
- In that window, fill the information as FieldData TypeWidthRoll NumberText5NameText50AgeNumeric2SexText1
- Right Click on Roll Number , then select Primary Kay from the drop down list ..to make the Roll Number field a primary key(Because roll number has to unique and non null value)
- Click on Close button
- Then a dialog box will appear telling you to give a table name for the created table(Give a name for the table,say, Student Master)
So.now what you get is a database named db1.mdb , with a table named Student Master with no records in it.
Now fill in the recorde in the table and close the window.
==============================================
(B) Providing a front end through VB to link with the DataBase :
Open VB
Now fill in the recorde in the table and close the window.
==============================================
(B) Providing a front end through VB to link with the DataBase :
Open VB
- Insert 4 Labels, 4 TextBoxes, and one DataControl .
- Change the captions of the components a s follows : Label1 to RollNo , Label2 to Name, Label3 to Age , Label4 to Sex. And delete the captions of all the TextBoxes, and change the caption of data control to Student Master File as shown above :
- From the databasename property ,choose the path where you saved the database file (here,db1.mdb) , by pressing the ellipse button (....) .
- Now, we have to select the tablewhich you will be linking your form to. To do this , click on the RecordSource property of the Data Control , and you will get all the tables listed, which are a part of the data base to which this data control is linked with.(Since only one table was created in the database, only one table is shown in the list).
- Select all the textboxes and change the DataSource property to Data1, since all the text boxes have to be linked with the database that is linked with data control Data1
- Select the text1 text box and change the DataField property.When you click on the data field property, it will show you a drop down list.All you have to do is to , choose the field with which you want this text box to be linked with.So choose RollNo from the list.
- Like above, change the data field property of Text2 to Name, Text3 to Age and text4 to Sex.
- Now , every control in the form1 is linked with some or the other component to import the data from the data base db1.mdb which we created in MS-Access.
- Save the project
- Now, click on the start button to run the application, use navigation buttons to navigate the records in the database.
=========================================================================