|
| Problem with combobox |
 |
Tue, 17 Oct 2006 12:40:17 +020 |
On my login form I have a combobox where a customer has to be selected.
The user may or may not have access rights to the customer's data. These
rights have been saved in a database table. If the user has access
rights, all is well. However, if he tries to log in with a customer for
which he has no access rights, he gets an error message. This is alright
too. Now if he consequently changes to another entry of the combobox,
the SelectedIndex/SelectedValue don't get updated and the database query
now runs with the wrong customer ID (that of the first, unsuccessful
attempt), which obviously results in the user not being granted access.
I have tried all and sundry but cannot figure out how to get at the
correct SelectedValue. As a matter of fact, after the second attempt
(i.e. that with a valid customer but with a wrong SelectedValue in the
corresponding query) the combobox once again displays the value of the
previous customer.
The databinding of the combobx is set up as follows:
with combobox1 do
begin
DataBindings.Add('SelectedValue', dataview1, compID);
DisplayMember := compSign;
ValueMember := compID;
DataSource := ds.Tables['Company'];
end;
The query is
db.get_dataset(ds,'Select * from tbl_sysusermember where fld_user = ' +
ds.tables['Benutzer'].rows[0].item['usernmb'].ToString +
' and fld_company = ' + combobox1.SelectedValue.ToString ,da,
'Rechte',false);
Any ideas?
TIA.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|