Re: How could I store values from checked checkboxlist onto database?
- From: Gerry Hickman <gerry666uk@xxxxxxxxxxxxxxxx>
- Date: Wed, 22 Aug 2007 22:41:20 +0100
Hi,
It would appear there's no such thing as 'bool' in MSSQL. There's a data type called 'bit' that can be 0, 1 or NULL. This might be ideal for a checkbox because a checkbox is actually a tristate control, it can be un-checked, checked or undefined (grey).
will~ wrote:
Visual Studio 2005 [C#], MS SQL 2005 database
I am working on a survey using VS 2005, connected to a MS SQL 2005 database. Using ASP.NET2.0 controls (textbox, checkboxlist, dropdownlist). A submit button would run "SqlDataSource1.Insert();" to insert user data into the connected database.
Using the control ID as the formfield name, I have managed to pass values entered in textboxes, or selected via dropdownlist into the database.
<InsertParameters>
<asp:formparameter Name="businessName" formfield="BusinessName_TextBox" Type="String" />
<asp:formparameter Name="mainContact" formfield="MainContact_TextBox" Type="String" />
<asp:formparameter Name="email" formfield="EmailAddress_TextBox" Type="String" />
<asp:formparameter Name="phone" formfield="Phone_TextBox" Type="String" />
<asp:formparameter Name="Q1" formfield="Part1Q1_DropDownList" Type="String" />
~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~
But I do not know how to store values from the checkboxlist. Within the database I have created fields for all available options. (E.g Q2a, Q2b, Q3c) and the aim is to pass the checked values into its corresponding fields in the database.
I am using C#, could anyone assist? Many thanks in advance,
--
Gerry Hickman (London UK)
.
- Follow-Ups:
- Prev by Date: Re: Trying to get reference from the GAC
- Next by Date: Re: Disabling the resilience features.
- Previous by thread: Why Visual Studio 2005 don't set a default namespace?
- Next by thread: Re: How could I store values from checked checkboxlist onto databa
- Index(es):