Visual Basic Data Projects

OLE DB Object Services is compatible with Visual Basic Data Projects.

The following procedure explains how to create a simple report with a VB Data Project. For general information about ADO, see ActiveX Data Objects documentation from Microsoft.

To create a simple report with a Visual Basic Data Project

  1. Start a new Data Project in VB.
  2. Double-click DataEnvironment1 from the Project Window to access the DataEnvironment1 dialog box.
  3. Click on Connection1 in the DataEnvironment1 dialog.
  4. Set the ConnectionSource property of Connection1 to:

    "Provider=Lawson.LawOLEDBC;Password=XXX;User ID=XXX;Data Source=XXX;Persist Security Info=True"

  5. Set the CursorLocation property to adUseServer
  6. Right-click your mouse on Connection1 in the DataEnvironment1 dialog.
  7. Select Add Command from the context menu.
  8. Click on Command1 in the DataEnvironment1 dialog.
  9. Set the CommandType property to adCmdTable.
  10. Set the CommandText property to DEPTCODE.
  11. Set the CursorLocation property to adUseServer.
  12. Set the CursorType property to adOpenStatic.
  13. Set the LockType property to adLockReadOnly.
  14. Set the MaxRecords property if you want to limit the number of records.
  15. Paint the report.
    1. Double-click on DataReport1 from the Project Window to open the data report designer window.
    2. Position the DataEnvironment1 dialog box and the report designer window so both windows are visible. Click the plus symbol near Command1 in the DataEnvironment1 dialog box so that the fields of the DEPTCODE table are visible.
    3. Click the NAME field and drag it to the detail section of the data report. After you drop the NAME field on the detail section of the data report, click the white space area of the detail section to deselect what you just dropped.
    4. Select the NAME: portion of what you dropped and drag it to the Page Header portion of the report. Move the NAME[Command1] part so that it is beneath the NAME: heading.
  16. Finish setting up the report.
    1. Click the DataReport1 window bar so that the DataReport1 properties appear in the property window.
    2. Set the DataSource property to DataEnvironment1.
    3. Set the DataMember property to Command1.
    4. Set the Startup Object property in the Project Properties dialog to DataReport1.
    5. Run the project.