🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.winforms.controls.using
Article #34

Problem with combobox

#34
From: Brigitte Spatz
Date: Tue, 17 Oct 2006 10:40
37 lines
2458 bytes
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.

Brigitte
Technical Details
Message-ID: <4534b320@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1eff29,78ea91d84a7f9993,start
X-Google-Attributes: gid1eff29,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 17 Oct 2006 12:40:17 +0200
From: Brigitte Spatz <brigitteNOSPAM.spatz@svenmahn.de>
Organization: Sven Mahn IT-Systementwicklungen
User-Agent: Thunderbird 1.5.0.7 (Windows/20060909)
MIME-Version: 1.0
Newsgroups: borland.public.delphi.winforms.controls.using
Subject: Problem with combobox
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 0641-5, 16/10/2006), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 217.189.155.31
Message-ID: <4534b320@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1161081632 217.189.155.31 (17 Oct 2006 03:40:32 -0700)
Lines: 37
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail