473,545 Members | 1,471 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 "MultiExten ded" 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 2375
Rad
On Tue, 14 Nov 2006 11:54:52 -0500, "Jay Ruyle"
<ja*****@rdjarc hitects.comwrot e:
>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 "MultiExten ded" 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*****@rdjar chitects.comwro te:
>>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 "MultiExten ded" 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.c om...
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*****@rdja rchitects.comwr ote:
>>>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
ProjectNam e nvarchar
ValidPhase s bigint (using listbox in c# with values
bound to lookup table above)
...Otherstuf f...
Other notes:
I do have "MultiExten ded" 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
4072
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 the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can...
2
2091
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 selections in a form and from those selections present them in a report. For example select a selection A,B, and C out of 9 possible choices. ...
2
5735
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 make multiple selections. The problem I am having is that when I use the shift key to select a range of items, I first click on one item (item gets...
0
1355
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 My_Store_Procedure and fill dataset.
5
3516
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 selected items of that listbox and display it. can anyone help? Thanks
0
1430
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
3110
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 a way to export more than on item at time. The ideal result would be to be able to drag the selected files, but as soon as I click on the LB to...
7
8963
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 etc but I am not too sure sure how to get more windows poppping to get more information. I mean when you click something, a new windows would open...
0
3008
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, bound to a table containing the food types. <EditItemTemplate> <asp:ListBox ID="ListBox1" runat="server" AppendDataBoundItems="True"...
0
7465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7656
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7416
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5969
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5325
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3449
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1878
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 we have to send another system
1
1013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.