SETTING DEFAULT VALUE AND DISPLAYING IN CHECKBOXES

Ashish Pandey

Total Post:128

Points:898
Posted by  Ashish Pandey
C# 
C#
 914  View(s)
Ratings:
Rate this:
Hi Everyone!

Okay so this is a bit of a double question problem, but they are both related. The first question is how would I set a default value for my column as I want it to be

true/1 (it's a bit column in case you hadn't guessed) and the second issue is that I have a row of checkboxes and I want these to be ticked when I have the value set

as true, my current command is:

cmd.CommandText = "ALTER TABLE tbl_ecom_cat_feature ADD display_on_search BIT";

Thanks in advance!
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: Setting default value and displaying in checkboxes

    Hi Ashish!


    For Get Default Value Use : SELECT * FROM INFORMATION_SCHEMA.COLUMNS Where ...

    For Set Default Value Use : ALTER TABLE {TABLENAME} ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL} CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!