SQL Server Yes/No Field | Type

Поделиться
HTML-код
  • Опубликовано: 5 янв 2025

Комментарии • 6

  • @bigrevkev55
    @bigrevkev55 3 года назад

    I've created a form that inserts data into my table. The first bit column works correctly. However, There are 3 other bit columns and they are incorrect. For example on the 4 columns if I enter 0.0.0.0 on the form it goes in the DB as False, True, True, True. If I Enter True, True, True, True on the form, it goes in the DB as True, False, False, False. So no matter what, the first column is correct but the other 3 are incorrect. Any suggestions?

    • @bigrevkev55
      @bigrevkev55 3 года назад

      Note - That's only if I use the form. If I manually enter the data directly in the table it is correct. I don't see anything in the code for the form that is different for the first column than the other 3.

    • @databasetales3562
      @databasetales3562  3 года назад

      Without looking at the code I would guess it might be an array and the first bit (key) is getting set then saving "nothing" for the other 3 fields by default.
      I would look at the actual value being posted by the form. If you look at the $_POST or $_REQUEST values you should have a value or 1 or 0 or True or False, depending on the form. Then look at the page item, what does a check box submit, a radio or a yes/no drop down box send to $_POST.
      SQL will except 1 or 0 and the strings 'True' or 'False'... you can see this in SSMS by "editing" a table and then placing these values in the bit field.

    • @bigrevkev55
      @bigrevkev55 3 года назад

      @@databasetales3562 thanks. I somehow stumbled around enough to get it working correctly again. Thank you.

  • @Jacu_Su
    @Jacu_Su 2 года назад +1

    thank you !