How to connect to database
Step 1
To connect to your database, just click on the Data tab under your Toolbox. The click on OleDBDataAdapter and pull it to your form.
Data Adapter Configuration wizard will appear.
Step 2
Click Next to continue.
Step 3
In the Choose connection, click on New Connection
Step 4
Select Microsoft Jet 4.0 OLED DB Provider and click Next.
Step 5
We will use an Access database that is located in C:\inetpub\wwwroot\net as show above.
Then you can set the access permission to your database.
Step 6
Click on Ok when done.
Step 7
Click on Next to continue.
Step 8
Verify that use SQL Statement is chosen and click on Next to continue.
Step 9
In the generate SQL statement, just use an SQL that will be able to retrieve data from your database. In this example we will use SELECT * FROM PROFILE where profile is a table in this database.
Step 10
Click on Next to continue.
Step 11
Click on Finish to complete it.
Note that OleDBConnection is automatically generated.
No comments:
Post a Comment