-
April 11th, 2014, 12:50 AM
#1
storing checkbox rsponse in bit and binary
Hello
I have created one page in C#.net and there I have kept 6 different checkboxes to select option and then I want to convert this response into binary and want to store in binary format to database. so, how could I?
I have already stored it in string as below but I want to store it in binary format so, any one can say me?
Code:
StringBuilder Selection1 = new StringBuilder();
foreach (ListItem item in Checkbox_c1.Items)
{
if (item.Selected)
Selection1.Append("1");
else
Selection1.Append("0");
}
string cmbn1sequn = Selection1.ToString();
but now I wanted to store it in binary format. so, how?
and other question is that how should I have to write in sql query to store bit in database?
-
April 11th, 2014, 03:15 AM
#2
Re: storing checkbox rsponse in bit and binary
Example with the bit field:
Code:
-- create a table
USE [MyDB]
GO
CREATE TABLE [dbo].[BitTest](
[BitField] [bit] NOT NULL
) ON [PRIMARY]
GO
-- insert a bit value
INSERT INTO [MyDB].[dbo].[BitTest]
([BitField])
VALUES
(1)
GO
-- change bit value
UPDATE [MyDB].[dbo].[BitTest]
SET [BitField] = 0
GO
Victor Nijegorodov
-
April 11th, 2014, 03:21 AM
#3
Re: storing checkbox rsponse in bit and binary
Originally Posted by jay patel
I have created one page in C#.net and there I have kept 6 different checkboxes to select option and then I want to convert this response into binary and want to store in binary format to database. so, how could I?
...
but now I wanted to store it in binary format. so, how?
Have a look at this thread. The idea is starightforward.
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|