Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

asp.net, c# I have only one checkbox, and I want to keep NULL to the SQL server

ID: 3794313 • Letter: A

Question

asp.net, c#

I have only one checkbox, and I want to keep NULL to the SQL server until the user checks the checkbox then change a Null to the 1, which is check, and 0 which is unchecked.

how can I do that?

this is my code from asp.net

<td valign="top"><br />
<asp:Panel ID="rblMandatoryAppearanceBox" runat="server" Height="24.5px" BorderWidth="1" BorderColor="#7F9DB9" BorderStyle="Solid">
<asp:CheckBox ID="lblMandatoryAppearance" runat="server" Text="MandatoryAppearance" />
</asp:Panel>

</td>

and c# code:

if (lblMandatoryAppearance.Checked.Equals(-1))
{
lgl_eve.MandatoryAppearance.Equals(0);
}
else
{
lgl_eve.MandatoryAppearance = Convert.ToBoolean(lblMandatoryAppearance.Checked);
}

I have column in SQL and I want if the user open the web.aspx so many times and do not click on the checkbox, keep it as NULL in the SQL, and any time user open the web.aspx and click on the checkbox, change the value in SQL to 1 which means selected and if user unchecked the checkbox make it to 0 in SQL which is unchecked

in fact, I want to be null as long as a user do not click on the checkbox.

how can I do that, please help.

Explanation / Answer

import java.util.Scanner; import java.util.Random; public class GuessingGame { public static void main(String[] args) { //Variables Random randomNumber = new Random(); Scanner kbd = new Scanner(System.in); int computerValue; int numberOfTries = 0; int success = 0; int guess; boolean playAgain; //Logic and While Loop do { computerValue = randomNumber.nextInt(100); guess = 0; playAgain = false; while (guess != computerValue) { System.out.println("Please enter an integer betwen 1 and 100 inclusive: "); guess = kbd.nextInt(); numberOfTries++; if (guess < 1 || guess > 100) { System.out.println("Invalid input"); } else if (guess computerValue) { System.out.println("Your guess is too high!"); } } success++; System.out.println("Congratulations you won! Your numbers of tries was: " + numberOfTries + " and the number was: " + computerValue); System.out.println("Would you like to play again?"); switch (kbd.next()) { case "yes": playAgain = true; break; default: break; } } while (playAgain); System.out.println("Goodbye"); } }