RATE THIS ANSWER
+1
Click to Vote:
1
0
Last Answered:
Apr 4 2008 9:43 PM GMT
by Mrdenny
As you are using radio buttons that means that you only except the user to select one or the other. Proper database design would then dictate that you store the value of the selected radio button in a single field. You should also be storing a numeric value which would then relate to a look up table for proper normalization. Your table should look something like this.
CREATE TABLE YourTable
(Id INT,
OwnershipId INT,
Your Other Columns)
CREATE TABLE Ownership
(OwnershipId INT,
OwnershipDesc NVARCHAR(20))
INSERT INTO Ownership
SELECT 1, 'Rent'
UNION
SELECT 2, 'Own'
UNION
SELECT 3, 'Live With Parents'
Then if they select Rent as the radio button you put 1 into the field. If they select Own you put a 2.
The way you are currently doing it you will always have a NULL in one of the columns.
You should also look into using stored procedures to handle the inserts as this is a much more secure method and will make a lot of this quite a bit easier.