T
tbergman
Guest
Very reasonable –Ask for use case. There is one. After all, I didn’t just find this by random chance. J I have an application that needs to write large amounts of data into a .Net DataTable (and later this data goes into a SQL Database). The class that does this has to be able to accept any temp-table with any number of fields. It creates a .Net data table, examines the temp-table schema and creates a schema in the DataTable, then it has to copy all the temp-table data to the DataTable. This is sometimes millions of rows, a hundred or more columns. Taking a fully dynamic approach worked well but was a little slower than I liked. By dynamic I mean a dynamic query, then looping through every field, assigning the value of the field to the correct DataTable column. I found that by generating a progress program, with a static temp-table definition for all of the fields, a for each on the static table, and static assignments of all the field values, the performance was three times faster. So I write out some code. Then run it. Then delete it. By now you’ve realized how I found the problem. One of the programs that used this class had a dynamic temp-table with a field named “Publisher(s)” which caused the generated program to fail to compile on the fly. I know, a bit bizarre, but there you have it. And yes, an easy answer is to stop doing that, which is exactly what I did with the offending program. Tom
Continue reading...
Continue reading...