Displaying records of an Access tableWe can display records of a table by looping through all the records of a recordset object. Recordset object properties are discussed before. We have to connect to our Access table using connecting string before collecting our records.Now let us use our emp table where we have stored our employee details. This table has four fields. Filed name emp_no stores the unique employee number of the employee. Then Name field stores the name of the employee, desg field stores the designation of the employee then the last one dept field stores the department name of the employee. Using connecting string we can connect and then we will use one sql command to select records from the table.
Here is our sql query to select records
After opening the recordset object we will use recordset properties and then we will use Do Wile loop to loop through the records of the recordset. Here at the beginning of the each loop the condition of EOF is checked and if NOT TRUE then the loop is executed. Inside the loop we display two fields of each record by using their filed names like this.
This way all the records are displayed and the loop ends if the last record is shown.
This is the simplest way to display records of a access table. Here is the output of the script.
Here is the complete code
This article is written by plus2net.com team.
Be the first to post comment on this article : ![]() |
Changing second list values based on selection of first list Connecting string and recordset object for data handling of Access db Recordset object properties like EOF, BOF, MoveNext etc in ASP to browse through the records Displaying all the records of an access table by looping through the records Dynamically listing drop down list options with formatted access table data |