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
- Start a new Data Project in VB.
- Double-click DataEnvironment1 from the Project Window to access the DataEnvironment1 dialog box.
- Click on Connection1 in the DataEnvironment1 dialog.
-
Set the ConnectionSource property of Connection1 to:
"Provider=Lawson.LawOLEDBC;Password=XXX;User ID=XXX;Data Source=XXX;Persist Security Info=True"
- Set the CursorLocation property to adUseServer
- Right-click your mouse on Connection1 in the DataEnvironment1 dialog.
- Select Add Command from the context menu.
- Click on Command1 in the DataEnvironment1 dialog.
- Set the CommandType property to adCmdTable.
- Set the CommandText property to DEPTCODE.
- Set the CursorLocation property to adUseServer.
- Set the CursorType property to adOpenStatic.
- Set the LockType property to adLockReadOnly.
- Set the MaxRecords property if you want to limit the number of records.
-
Paint the report.
- Double-click on DataReport1 from the Project Window to open the data report designer window.
- 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.
- 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.
- 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.
-
Finish setting up the report.
- Click the DataReport1 window bar so that the DataReport1 properties appear in the property window.
- Set the DataSource property to DataEnvironment1.
- Set the DataMember property to Command1.
- Set the Startup Object property in the Project Properties dialog to DataReport1.
- Run the project.