Hello,
I had a question on how I would go about generating a web form based of sql data types. For example, if I ran the query (or one like it):
CODE
SELECT TABLE_NAME, COLUMN_NAME, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS
And it generated something like this:
Partner PartnerID NO int NULL
Partner LoginID NO int NULL
Partner Organization YES varchar 200
Partner ContactName YES varchar 200
Partner Title YES varchar 200
Partner Address YES varchar 200
Partner Phone YES varchar 50
Partner Extension YES varchar 50
Partner Email YES varchar 200
Partner Website YES varchar 200
Partner MissionStatement YES text 2147483647
Partner NeedsStatement YES text 2147483647
Partner AdditionalInformation YES text 2147483647
Login LoginID NO int NULL
Login Login NO nvarchar 50
Login Password NO nchar 50
How could I go about using the fact that I know title is a varchar(200) and display a label and textbox so they could populate that field? Or if I know that MissionStatement is a text object to display a label and mulitline text box?
The only thing I could think of was using a repeater, but I need a way to almost do a case statment, i.e.
CODE
switch(datatype)
{
case "text":
// display multiline textbox w/ given properties
case "varchar":
// displaya single line textbox
case "int":
// display checkbox or something
}
Any ideas? I just need a starting point as I'm still fairly new at visual C#.
Thanks for the help. Let me know if you need more explaination.
Tom