473,503 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using bitwise to create a multiple selection listbox and having it bound to a sql

I'm trying to figure out a way to list several items in a listbox and let
the user select any number of items in the listbox. I have tried to code in
the items as bitwise items but all it stores in the database is the top item
in the listbox.

How can I get the listbox to add all the bit values to be stored and also
come out properly when viewed later?
Example:

SQL Table = Valid Phases Lookup
Name Bitwise
Phase-10 1
Phase-20 2
Phase-30 4
Phase-40 8
Phase-60 16
Phase-70 32
SQL Table = Projects
Name Stored Type
ProjectName nvarchar
ValidPhases bigint (using listbox in c# with values
bound to lookup table above)
....Otherstuff...
Other notes:
I do have "MultiExtended" as the Selection Mode.
ValueMode to use the bitwise value.

Just having trouble getting the bitwise values to add up in the program and
send the correct value to the database.

Ive attempted a custom listbox and combo-box. Please help.

Jay
Nov 14 '06 #1
3 2372
Rad
On Tue, 14 Nov 2006 11:54:52 -0500, "Jay Ruyle"
<ja*****@rdjarchitects.comwrote:
>I'm trying to figure out a way to list several items in a listbox and let
the user select any number of items in the listbox. I have tried to code in
the items as bitwise items but all it stores in the database is the top item
in the listbox.

How can I get the listbox to add all the bit values to be stored and also
come out properly when viewed later?
Example:

SQL Table = Valid Phases Lookup
Name Bitwise
Phase-10 1
Phase-20 2
Phase-30 4
Phase-40 8
Phase-60 16
Phase-70 32
SQL Table = Projects
Name Stored Type
ProjectName nvarchar
ValidPhases bigint (using listbox in c# with values
bound to lookup table above)
...Otherstuff...
Other notes:
I do have "MultiExtended" as the Selection Mode.
ValueMode to use the bitwise value.

Just having trouble getting the bitwise values to add up in the program and
send the correct value to the database.

Ive attempted a custom listbox and combo-box. Please help.

Jay
There's a difference between the storage of datetime values in the
..NET framework and SQL Server. Read these articles for some details of
the difference and some possible workarous:

http://www.velocityreviews.com/forum...e-problem.html

http://www.eggheadcafe.com/articles/20021111.asp

http://blogs.wdevs.com/angelos/archi...6/02/3660.aspx
Nov 14 '06 #2
Rad
On Wed, 15 Nov 2006 00:24:38 +0300, Rad <no****@nospam.comwrote:
>On Tue, 14 Nov 2006 11:54:52 -0500, "Jay Ruyle"
<ja*****@rdjarchitects.comwrote:
>>I'm trying to figure out a way to list several items in a listbox and let
the user select any number of items in the listbox. I have tried to code in
the items as bitwise items but all it stores in the database is the top item
in the listbox.

How can I get the listbox to add all the bit values to be stored and also
come out properly when viewed later?
Example:

SQL Table = Valid Phases Lookup
Name Bitwise
Phase-10 1
Phase-20 2
Phase-30 4
Phase-40 8
Phase-60 16
Phase-70 32
SQL Table = Projects
Name Stored Type
ProjectName nvarchar
ValidPhases bigint (using listbox in c# with values
bound to lookup table above)
...Otherstuff...
Other notes:
I do have "MultiExtended" as the Selection Mode.
ValueMode to use the bitwise value.

Just having trouble getting the bitwise values to add up in the program and
send the correct value to the database.

Ive attempted a custom listbox and combo-box. Please help.

Jay

There's a difference between the storage of datetime values in the
.NET framework and SQL Server. Read these articles for some details of
the difference and some possible workarous:

http://www.velocityreviews.com/forum...e-problem.html

http://www.eggheadcafe.com/articles/20021111.asp

http://blogs.wdevs.com/angelos/archi...6/02/3660.aspx
Sorry, mixed up my Agent windows :(

But since I am here anyway, I might as well chip in.

First of all, If I understand your architecture. If someone selects
Phase 10 and Phase 20, I am you store 3 in the database.

If this is the case I'm not sure you can databind directly.

You might have to loop through your listbox items to manually select
the valid phases.

Random question ... How do you handle queries with this design? How
can I retrieve all items at Phase 10 and Phase 20?
Nov 14 '06 #3

"Rad" <no****@nospam.comwrote in message
news:4o********************************@4ax.com...
On Wed, 15 Nov 2006 00:24:38 +0300, Rad <no****@nospam.comwrote:
>>On Tue, 14 Nov 2006 11:54:52 -0500, "Jay Ruyle"
<ja*****@rdjarchitects.comwrote:
>>>I'm trying to figure out a way to list several items in a listbox and let
the user select any number of items in the listbox. I have tried to code
in
the items as bitwise items but all it stores in the database is the top
item
in the listbox.

How can I get the listbox to add all the bit values to be stored and also
come out properly when viewed later?
Example:

SQL Table = Valid Phases Lookup
Name Bitwise
Phase-10 1
Phase-20 2
Phase-30 4
Phase-40 8
Phase-60 16
Phase-70 32
SQL Table = Projects
Name Stored Type
ProjectName nvarchar
ValidPhases bigint (using listbox in c# with values
bound to lookup table above)
...Otherstuff...
Other notes:
I do have "MultiExtended" as the Selection Mode.
ValueMode to use the bitwise value.

Just having trouble getting the bitwise values to add up in the program
and
send the correct value to the database.

Ive attempted a custom listbox and combo-box. Please help.

Jay

There's a difference between the storage of datetime values in the
.NET framework and SQL Server. Read these articles for some details of
the difference and some possible workarous:

http://www.velocityreviews.com/forum...e-problem.html

http://www.eggheadcafe.com/articles/20021111.asp

http://blogs.wdevs.com/angelos/archi...6/02/3660.aspx

Sorry, mixed up my Agent windows :(

But since I am here anyway, I might as well chip in.

First of all, If I understand your architecture. If someone selects
Phase 10 and Phase 20, I am you store 3 in the database.

If this is the case I'm not sure you can databind directly.

You might have to loop through your listbox items to manually select
the valid phases.

Random question ... How do you handle queries with this design? How
can I retrieve all items at Phase 10 and Phase 20?
Correct you would store 3 in the database.

I did make it unbound , but when I grab the value from the listbox it
returns the value of the top item and not a collection of items or tally of
the bit items.

Random answer: Bitwise calculation.

0 = 00000000

1 = 00000001

2 = 00000010

3 = 00000011

4 = 00000100

5 = 00000101

You can use a bitwise calculation to determine which bits are turned on and
off.
Article that talks about the advantage of using bitwise data in a database.
http://www.sqlservercentral.com/colu...koperators.asp

Jay
Nov 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
4065
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
2
2090
by: Craig B. | last post by:
I am relativly new to access 2000 and am having some trouble with a report. I am not sure what I want to do is something I can do in access. I want to be able to choose from a combo box multiple...
2
5729
by: Matt Sawyer | last post by:
Hi, I'm attempting to do a drag and drop operation from one listbox to another. I have my listboxes setup with SelectionMode = MultiExtended so that I can use the shift key, cntrl key, etc. to...
0
1353
by: Adis | last post by:
Asp.Net Visual Studio 2003 SQL Server. Hi, I have database in Sqlserver and ListBox (Multiple Selection Mode) in my Visual Studio Webform. I wish obtain various records from...
5
3513
by: Lie | last post by:
Hi all, I have problem in getting selectedindex of multiple listbox selection in a datagrid. I have a listbox with multiple selection mode inside datagrid. In Edit mode, I need to get back all...
0
1426
by: antonyliu2002 | last post by:
I am not new to programming, but I am new to VB .NET. I have a multiselect listbox like this: Please select your favorite fruit: Apple Banana Coconut Date
2
3105
by: Dolorous Edd | last post by:
Hi, for a program I'm working on I need to be able to drag multiple files between Windows Explorer and a ListBox, in both directions. Implementing the "drag in" was pretty easy, but I can't find...
7
8960
by: diffuser78 | last post by:
I recently tried a hand at wxGlade and was happy to see it designs a GUI for you in minutes. I am a newbie Python coder. I am not completely aware of GUI programming. I can easily make menubars...
0
3006
by: awmb | last post by:
Language C#, Version ASP.Net 2.0 Hi I have a GridView which is bound to a table which contains Restaurant information. In the Edit Row there is a Listbox (ListBox1) in the Food Type column,...
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.