We do not have to write code to add data, update data, but if a table field too much, the amount of code to write will be increased, such as using StringBuilder splicing Insert SQL statement;
Code that is not technically available can be generated from a code generator, or it can be generated by using SQL as a table field:
1, the following code is to find all the field names in a table
Select name from syscolumns where id=object_id (' Table name ')
2, on the basis of 1 we can arbitrarily splicing our return results, such as we need to be all the fields with commas (of course, can be implemented by SQL recursion, but if the results are no longer logical judgment, you can try the following method faster)
Use the Select name + ', ' from syscolumns where id=object_id (' table name ') statement to execute the result, and then copy the entire column value into EditPlus, and you can get a string of strings as you merge the rows.
3, based on the 2nd step thinking, we can use arbitrary splicing according to demand
Select' _insertsql.append (", '" "+_k3dt. rows[i]["'+name+' "]. ToString () + "" "); ' fromsyscolumnswhereID=object_id(' T_icitem ')
Querying table fields and stitching code using SQL syscolumns