• Announcements

Archived

This topic is now archived and is closed to further replies.

Database programming question...

Recommended Posts

Is it possible, via ADO.Net, to obtain a given table and enumerate the names of the column in that table? My reason for wondering is that i''ve got to fill in a table entry that could have up to 78 items and it would be easier and less typo prone if I could just enumerate the names of the fields to fill and build the sql string to insert into the table iteriatively through code. so, in psuedo code:
array[] columns = table.columns;
string fields;
string values;

for( int i = 0; i < columns.count; i++ )
{
fields += column+",";
values += data[i]+",";
}

string sql = "INSERT INTO table using"+fields+"("+values+");";

no, that sql statement isn''t valid, but you get the idea i hope. Mike.

• Partner Spotlight

• Forum Statistics

• Total Topics
627664
• Total Posts
2978522

• 10
• 10
• 12
• 22
• 13