c# - How to use true, false and both condition in sql server -


I have a check box in my design (active) This stores either 0 or 1. I need to find items based on the check box value, i.e., active or inactive or both. For activating I can use 1 and I can use 0 to be inactive. But I need to use all the conditions (true, false, truth and false).

Assume:

  • You have 0 for active, To activate 1
  • < Li>> Where such type of section:

      - is the name of the active column and @active is the query parameter WHERE {Existing rule} and (@active = 2 or @active = Active)  

    update:

    Because you have not added the appropriate tags, so I have UI and ado . You can use these methods for other technologies.

    For Winforms: Assume that your checkbox its threeSTATE property ( IsThreeState in WPF) is passed to true , you can receive and pass values ​​like this:

      SqlCommand cmd = conenction.CreateCommand (); Active active; Switch (checkbox 1. checkstate) {case checkstate. Checked: active = 1; break; Case Checkstate Uncheck: active = 0; break; Case Checkstate Identity: active = 2; break; } / * // For WPF: If (checkbox 1. ISKCED .Hass value) active = check box 1. What is checked? 1: 0; Other active = 2; * / CMD Parameter. EdvatValue ("active", active);  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -