In my C# Web Application I have simple page where a user enters their first name in one textbox (named txtFirst) and their last name in another textbox (named txtLast). After they enter this information in the two textboxes, they click on a continue button which saves the data to a SQL database. My problem is trying to save these values in SQL. I have a "Value" table (columns are PersonID, AttributeID, and Value) and an "Attribute" table (columns are a primary key AttributeID and AttributeName).
In my Attribute table I have the following:
AttributeID: AttributeName:
1 FirstName
2 LastName
My goal is to have this save in the Value table as:
PersonID: AttributeID: Value:
A 1 FirstName Value Here
B 2 LastName Value Here
I know how to save the data by directly passing it into a stored procedure, but how can I have the AttributeID get assigned correctly? (Example: AttributeID = 1 for FirstName and AttributeID = 2 for LastName). Is there a way I can assign the textboxes in the application to have a specific AttributeID or even by AttributeName? Thanks so much.
It might be confusing, but the idea here is for when the button is clicked, it pulls the AttributeID associated to FirstName from the table and then saves the value and that pulled AttributeID in table "Value". Thanks
TextBoxobjects, why do the objects need to keep the IDs? Just save the IDs in theViewStateorSessionand be done with it.