<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C#]]></title><description><![CDATA[<pre><code>string Isactive = chkBoxActive.Checked ? "TRUE" : "FALSE";
</code></pre>
<p dir="auto">// Isactive is a variable which store value of the checkbox. If the check box is checked the variable value will be TRUE if not the variable Value will be FALSE - Call the variable name to save it into the database.</p>
<pre><code>string radioButton1Value = radioButton1.Checked ? "TRUE" : "FALSE";
</code></pre>
<p dir="auto">// radioButton1Value is a variable which store value of the radioButton. If the radioButton1 is ticked , the variable value will be TRUE if not the variable Value will be FALSE - Call the variable name to save it into the database.</p>
]]></description><link>https://lankadevelopers.lk/topic/103/how-to-save-check-box-value-radio-button-value-into-sql-server-database-using-c</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 14:47:28 GMT</lastBuildDate><atom:link href="https://lankadevelopers.lk/topic/103.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 15 Jan 2019 13:19:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Thu, 31 Jan 2019 02:28:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/532">@lahirunc</a> , okay bro, thanks alot</p>
]]></description><link>https://lankadevelopers.lk/post/830</link><guid isPermaLink="true">https://lankadevelopers.lk/post/830</guid><dc:creator><![CDATA[tnlthanzeel]]></dc:creator><pubDate>Thu, 31 Jan 2019 02:28:38 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Wed, 30 Jan 2019 00:40:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/650">@tnlthanzeel</a> You can do it by only using this  <code>command.Parameters.AddWithValue("@CheckBoxChecked", chkbox.IsChecked);</code></p>
<p dir="auto">Other one was for knowledge purposes.</p>
]]></description><link>https://lankadevelopers.lk/post/822</link><guid isPermaLink="true">https://lankadevelopers.lk/post/822</guid><dc:creator><![CDATA[lahirunc]]></dc:creator><pubDate>Wed, 30 Jan 2019 00:40:56 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Tue, 29 Jan 2019 17:42:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/532">@lahirunc</a> , okay bro, but even in ur code there are 2 paramaters, cant we do it with one paramater?</p>
]]></description><link>https://lankadevelopers.lk/post/821</link><guid isPermaLink="true">https://lankadevelopers.lk/post/821</guid><dc:creator><![CDATA[tnlthanzeel]]></dc:creator><pubDate>Tue, 29 Jan 2019 17:42:41 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Mon, 28 Jan 2019 03:08:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/650">@tnlthanzeel</a> well there's nothing wrong with <a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/256">@nowferrifkan</a> nor mine. But if you ask the most efficient way?</p>
<p dir="auto">Then I would suggest mine as there's no point in assigning a value which is already boolean to string using tertiary if. That just produce messy code. You can convert using <code>.toString()</code></p>
<p dir="auto">eg:-</p>
<pre><code>chkbox.IsChecked.toString();
</code></pre>
]]></description><link>https://lankadevelopers.lk/post/806</link><guid isPermaLink="true">https://lankadevelopers.lk/post/806</guid><dc:creator><![CDATA[lahirunc]]></dc:creator><pubDate>Mon, 28 Jan 2019 03:08:20 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Mon, 28 Jan 2019 02:35:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/532">@lahirunc</a> ,whats the best method brother?</p>
]]></description><link>https://lankadevelopers.lk/post/805</link><guid isPermaLink="true">https://lankadevelopers.lk/post/805</guid><dc:creator><![CDATA[tnlthanzeel]]></dc:creator><pubDate>Mon, 28 Jan 2019 02:35:00 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Mon, 28 Jan 2019 02:14:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/650">@tnlthanzeel</a> well it's just for the better understanding. <code>@CheckBoxChecked</code> is <code>ParamNameHere</code>  and <code>valuehere</code> is <code>chkbox.IsChecked</code> value.</p>
]]></description><link>https://lankadevelopers.lk/post/804</link><guid isPermaLink="true">https://lankadevelopers.lk/post/804</guid><dc:creator><![CDATA[lahirunc]]></dc:creator><pubDate>Mon, 28 Jan 2019 02:14:09 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Sun, 27 Jan 2019 13:23:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/532">@lahirunc</a> , bro, why have u used two parameters to save the value of the checkbos?</p>
<pre><code>    command.Parameters.AddWithValue("@ParamNameHere", valuehere);
    command.Parameters.AddWithValue("@CheckBoxChecked", chkbox.IsChecked);

  @ParamNameHere and @CheckBoxChecked ?
</code></pre>
]]></description><link>https://lankadevelopers.lk/post/803</link><guid isPermaLink="true">https://lankadevelopers.lk/post/803</guid><dc:creator><![CDATA[tnlthanzeel]]></dc:creator><pubDate>Sun, 27 Jan 2019 13:23:08 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Fri, 25 Jan 2019 06:45:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/650">@tnlthanzeel</a> exactly my thought mate!</p>
]]></description><link>https://lankadevelopers.lk/post/796</link><guid isPermaLink="true">https://lankadevelopers.lk/post/796</guid><dc:creator><![CDATA[lahirunc]]></dc:creator><pubDate>Fri, 25 Jan 2019 06:45:52 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Thu, 24 Jan 2019 03:57:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/256">@nowferrifkan</a> , why use string to save the value of checkbox/radio button in the database?</p>
]]></description><link>https://lankadevelopers.lk/post/777</link><guid isPermaLink="true">https://lankadevelopers.lk/post/777</guid><dc:creator><![CDATA[tnlthanzeel]]></dc:creator><pubDate>Thu, 24 Jan 2019 03:57:52 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Fri, 18 Jan 2019 19:48:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/256">@nowferrifkan</a> Dude by using <code>chkbox.IsChecked</code> property you get the same thing as you do by your code. try and see. I just posted a code segment just for understanding purpose.</p>
<pre><code>using (SqlConnection connection = new SqlConnection("ConnectionStringHere"))
{
    using (SqlCommand command = new SqlCommand())
    {
        command.Connection = connection;            // &lt;== lacking
        command.CommandType = CommandType.Text;
        command.CommandText = "SQL Statment here (insert or update)";
        command.Parameters.AddWithValue("@ParamNameHere", valuehere);
        command.Parameters.AddWithValue("@CheckBoxChecked", chkbox.IsChecked);

        try
        {
            connection.Open();
            command.ExecuteNonQuery();
        }
        catch(SqlException)
        {
            //error here
        }
        finally
        {
            connection.Close();
        }
    }
}
</code></pre>
<p dir="auto">above is the correct code to save the data to db</p>
]]></description><link>https://lankadevelopers.lk/post/740</link><guid isPermaLink="true">https://lankadevelopers.lk/post/740</guid><dc:creator><![CDATA[lahirunc]]></dc:creator><pubDate>Fri, 18 Jan 2019 19:48:46 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Fri, 18 Jan 2019 07:50:27 GMT]]></title><description><![CDATA[<p dir="auto">Did you read the headline of this article?. And real the answers well dude.</p>
]]></description><link>https://lankadevelopers.lk/post/728</link><guid isPermaLink="true">https://lankadevelopers.lk/post/728</guid><dc:creator><![CDATA[nowferrifkan]]></dc:creator><pubDate>Fri, 18 Jan 2019 07:50:27 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Fri, 18 Jan 2019 19:41:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/256">@nowferrifkan</a></p>
<pre><code>if (checkBox.IsChecked)
{
  MessageBox.Show("CheckBox ticked");
}
else 
{
  MessageBox.Show("CheckBox unticked");
}
</code></pre>
<p dir="auto">So here if the checkbox has been checked then it will display Checkbox ticked else checkbox unticked. You don't have to go round and round using tertiary ifs and another variable to get its bool value.</p>
]]></description><link>https://lankadevelopers.lk/post/701</link><guid isPermaLink="true">https://lankadevelopers.lk/post/701</guid><dc:creator><![CDATA[lahirunc]]></dc:creator><pubDate>Fri, 18 Jan 2019 19:41:44 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Tue, 15 Jan 2019 16:30:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/532">@lahirunc</a> Post the sample code. I targeted the Beginners. So they can understand about the variable and these controls at once. Please Post your code brother. so readers get something from it.</p>
]]></description><link>https://lankadevelopers.lk/post/690</link><guid isPermaLink="true">https://lankadevelopers.lk/post/690</guid><dc:creator><![CDATA[nowferrifkan]]></dc:creator><pubDate>Tue, 15 Jan 2019 16:30:30 GMT</pubDate></item><item><title><![CDATA[Reply to How to save Check Box value&#x2F;Radio Button Value into SQL Server Database using C# on Tue, 15 Jan 2019 15:55:04 GMT]]></title><description><![CDATA[<p dir="auto">You can use checkbox.checked and radiobutton.checked straight away without going through this hassle.</p>
]]></description><link>https://lankadevelopers.lk/post/687</link><guid isPermaLink="true">https://lankadevelopers.lk/post/687</guid><dc:creator><![CDATA[lahirunc]]></dc:creator><pubDate>Tue, 15 Jan 2019 15:55:04 GMT</pubDate></item></channel></rss>