Home > DeveloperSection > Forums > Setting default value and displaying in checkboxes
Ashish Pandey

Total Post:128

Points:898
Posted on    May-04-2013 2:06 AM

 C# C# 
Ratings:


 1 Reply(s)
 693  View(s)
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!


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    May-04-2013 9:04 AM

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}


Don't want to miss updates? Please click the below button!

Follow MindStick