Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,106 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,723 people online right now. Registration is fast and FREE... Join Now!




Data-Driven Form Generation

 
Reply to this topicStart new topic

Data-Driven Form Generation, Using SQL Data types to determine what kind of objects should be displ

tommahhh
20 Nov, 2007 - 10:28 AM
Post #1

New D.I.C Head
*

Joined: 19 Nov, 2007
Posts: 4


My Contributions
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


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 09:18PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month