Hi,
I 've got 2 tables. The stucture of each table as follows:
ModuleName
ID - PK
Name
ModuleVersion
ID -PK
TblModuleName_ID
TblNote_ID
ModuleNumber
When i select a particular NoteID from the combo box available in the main form , it should show the relevant module name along with the module number in a listview.
the code i used is as below:
ListView.Clear;
With qryGeneral Do
Begin
SQL.Clear;
SQL.Add( 'SELECT ( a1.Name, a2.ModuleNumber )' );
SQL.Add( ' FROM TblModuleName a1, TblModuleVersion a2 ' );
SQL.Add( ' WHERE ( TblNote_ID="' + CB_RNo.Text + '" And ( a1.ID = a2.TblModuleName_ID) ' );
Open;
For i:= 1 to RecordCount Do
Begin
ListView.AddItem( ( FieldByName( 'ModuleNumber'). AsString ), nil);
ListView.Items.SubItems.Add(FieldByName('Name').
AsString );
Next;
End;
Close;
This caused an exception error. This is the first time i am using alias and i guess i am doing something terribly wrong. Can anyone help me out ...
Thank you sooooo much for u r help in advance.
Sanjna...
I 've got 2 tables. The stucture of each table as follows:
ModuleName
ID - PK
Name
ModuleVersion
ID -PK
TblModuleName_ID
TblNote_ID
ModuleNumber
When i select a particular NoteID from the combo box available in the main form , it should show the relevant module name along with the module number in a listview.
the code i used is as below:
ListView.Clear;
With qryGeneral Do
Begin
SQL.Clear;
SQL.Add( 'SELECT ( a1.Name, a2.ModuleNumber )' );
SQL.Add( ' FROM TblModuleName a1, TblModuleVersion a2 ' );
SQL.Add( ' WHERE ( TblNote_ID="' + CB_RNo.Text + '" And ( a1.ID = a2.TblModuleName_ID) ' );
Open;
For i:= 1 to RecordCount Do
Begin
ListView.AddItem( ( FieldByName( 'ModuleNumber'). AsString ), nil);
ListView.Items.SubItems.Add(FieldByName('Name').
AsString );
Next;
End;
Close;
This caused an exception error. This is the first time i am using alias and i guess i am doing something terribly wrong. Can anyone help me out ...
Thank you sooooo much for u r help in advance.
Sanjna...