build insert query on the fly based on table schema RRS feed

  • Question

  • Can anyone point to a template that will take a table's schema and build an insert or update query on the fly?

    I've got the schema from a table columnnames and datatypes in a Datatable's row.

    (From what I can see in ADO.NET, I need to add a row to a table to create a SQL Server tables schema for 'n' columns.

    "Insert into table

     ( for i = 1 to columncount, list the column names here, seperated by a comma)

     VALUES (for i = 1 to columncount, list business object member values, separated by commas)


    There is no need to worry about joins, this is for a single table only.




    Tuesday, November 13, 2007 3:14 PM