Pick Database field from asp.net page and save them

Ok here is what I am trying to accomplish, I have a table with lots of fields for registration of different products.  Each time they add a new product they want to be able to save the fields that they want to fill out in a db so that I do not have to hard code them each time with code.  So how can users pick which DB fields they want to save information agianst and save in table so that when they go to the page it pulls up only the fields that they picked to fill out?

So they add a product called WIFI
WIFI has the following properties that they want to capture
IP,
dataplan,
range
carrier
so they pick these fields from the registration table and save to antoher table that keeps the fields they picked so when they open the page it only shows the fields they picked.

IS this doable and can someone give me some guidlines on how to do and I can figure out most from there.
kdeutschAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PaulHewsCommented:
I would say you want a table for Product, with an extra table for ProductDataColumn

ProductDataColumn
Name
<Any other fields you need to describe or validate the data>

Relation:
Product one to many ProductDataColumn


You also need a table to store the data.  
ProductData:
ID
ProductID  (FK to Product)
ProductDataColumnID (FK to ProductDataColumn)
Data

Product one to many ProductData (each column has it's own row.)  Obviously you have to store all the extra data as strings, so converting where needed.
0
gery128Commented:
I could think this way only to achieve this:
(Lets say Table name is Product and you need to allow most of the field as Null)
1. Display all the fields of Product-table to user (using InformationSchema - ColumnName)
2. User will check fields relevant to it. And will click next.
3. Now you have user's choice about the Product-table fields (say, for WIFI he has chosen
IP,
dataplan,
range
carrier
but he ignored weight, length, type, resolution etc.)
So you will forward this chosen fields to next page and populate text-boxes, drop-downs or other controls for that fields with Labels off-course.
4. Once user fills, you will save/insert those 4-5 fields in Product table as record, inserting only relevant columns and ignoring the rest of it (that's why we need keep most of the fields null except ProductId or Unique key for that record.)
5. You have record in Product table, display it to user by checking which column has data and populate only those labels to show it to user.

Let me know if it fulfills your criteria.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PaulHewsCommented:
The only problem with gery128's solution is that you have to know all the field types in advance.  Otherwise you will be updating the columns on that table whenever you encounter a product that has a new feature/specification.  If that's okay, then that's the way to go.

On the other hand, my approach treats the extra columns as data, so you can add columns without refactoring the database structure when you want to add a new product with different features that need to be listed.
0
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

kdeutschAuthor Commented:
Hi,
The database is  already predetermined based of off the characteristics of IT products,  so when they insert a new IT Product they pick and save the fields from the DB they plan on using, so that it pops up on the page each time they go to it.  Then they can save the data and move on.
So it sounds like I can query the schema of a table and from here they will need to save which ones they pick into another db as the chosen fields from which the page will load these fields and tehn save the data to the table.
0
kdeutschAuthor Commented:
Ok,
Just so I am on right track, I found out how to query the table Schema, now I need to pick the columns I want, and then save these columns in another DB with the product and its accompany fields names from which I will query to put textboxes on the asp page which allows them to save the data.  Right track or wrong.
0
PaulHewsCommented:
Sounds like you are on track for the approach suggested by gery128.  It's certainly a good way to approach the problem.
0
kdeutschAuthor Commented:
Thanks for the good start, i have it all selecting and saving in a table. Next the harder part.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.