Then, a file object is opened mentioning the location of the text file where the data needs to be exported. Close obj.
These are some of the prime scenarios which are important in the proper understanding of the concept. Recordset Object provides a way to access the records from the database. WriteLine obj1. Recordset" objConnection.
Once you create a DSN for a particular database, you can use the DSN in an application to call information from the database. The objects are then closed as the task has been completed.
Then a Connection Object that is created above is opened to start working with the object by providing all the details about the provider like SQL SERVER, server name, database name, user id, and password.
Close End Sub. Save obj2. Worksheets 1 obj. Next, the main task is performed to store the values of name and age of a particular person in the excel file as per the query using fields of the recordset in the cells of the sheet from the database.