seeHOW TO: Retrieve Column Schema by Using the DataReader GetSchemaTable Method and Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;EN-US;310107
by the way, you might want to search for sql code generation:http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=sql+code+generation+C%23