Skip to main content
GameDev.net gamedev.net
🔒 Locked

Database programming question...

Started by Mike May 18, 2004 at 3:21 PM 0 replies 200+ views
Original Post
Mike
Mike
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.