473,245 Members | 1,742 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,245 software developers and data experts.

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 2359
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
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
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
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
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
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
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
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
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
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
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.