473,385 Members | 1,564 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Set CheckListBox to Checked Based on Database Query

Hi,

I want to mark the CheckListBox items as Checked based on a database query.

So the CheckListBox items should be checked if each item matches fundsAffected field from the below query...

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT fundsAffected as myFunds FROM myFunds AS f
  2. INNER JOIN myDetails AS d
  3. ON d.corpID = f.corpID
  4. WHERE d.securityID = securityID
How is this done? Thanks.
May 31 '07 #1
1 1920
Frinavale
9,735 Expert Mod 8TB
Hi,

I want to mark the CheckListBox items as Checked based on a database query.

So the CheckListBox items should be checked if each item matches fundsAffected field from the below query...

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT fundsAffected as myFunds FROM myFunds AS f
  2. INNER JOIN myDetails AS d
  3. ON d.corpID = f.corpID
  4. WHERE d.securityID = securityID
How is this done? Thanks.

Once you've retrieved all of the records from your database and stored them into a SqlDataReader, grab the "fundsAffected" field value and see if it is true or false...set your checkListBox accordingly.

Please see the .Net article on how to use a database in your program for help on how to loop through the DataReader.

-Frinny
Jun 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: MikeY | last post by:
Hopefully someone can help me on this. I am using C#, making Windows forms. I have created a listView with checkbox's. I have enabled the checkboxes under the properties, and all the data,...
2
by: Mike Kim | last post by:
hi all, i have a checklistbox populated with about 50 items from database. and on the same form, i added to button to do the following. if you click this button, i want to have all items in the...
2
by: cos75 | last post by:
When I populate a checklistbox with Add method every item is showed equal to the others I would show some item enabled, and some disabled......some item in black text and others in red text Is...
16
by: MSN | last post by:
xp pro/vs 2002/web forms/VB How do I make a checkbox checked when add it to a checkboxlist. Thanks
0
by: Ville Mattila | last post by:
Dear readers, I've some problems with the data binding of the checklistbox control. I'm using it with user preferences that are stored in a XML File. Information from the file is fetched with...
2
by: Aaron Reimann | last post by:
I have a lot of check boxes. This is an update of the check boxes, I want something was checked, then to do an insert (which is currently working), if something is no longer checked...delete the...
3
by: obrienkev | last post by:
Hi all, How do I mark an item in a checklistbox as checked based on a condition? e.g. if(x=1) { // SET a ChecklistBox Item as Checked }
2
by: Andy B | last post by:
I have a checked listbox with some rows in it from a database. If a person were to delete one or more of the checked items, how would you update the list to show the deleted items have been removed?
3
by: khalidjan9 | last post by:
I have data in an arraylist and i want to add data to checklist box on runtime and i also want to display a textbox besides it so that i get the comments example : checklistbox "text" textbox...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.