This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am new to coding.I got a requirement where the user could see the columns available in the table. And then he selects only few of the columns to see the data.
So I am planning to put a check box to every column so whatever the columns selected by the user we can identify.But the problem is how can I write a query after taking the database connection
for dynamic selection of columns?
Selecting all coulmn values can be an overhead .What is the problem in creating the SQL dynamically eg. if you are a web developer you can create a check box with column name as name of check box and create dynamic sql in java script and pass it to you java backend?
It will create a connection But if you load the entire data the page loading will be very slow and It is ok to create a connection if you are closing it after use.
And there is no way we can get the data with out a connection.
Worrying about overhead before it's known that there's something to worry about is called premature optimization and should be avoided. Do what makes the most sense, and then, and only then, if there's a performance issues, address it.
Bear Bibeault wrote:Worrying about overhead before it's known that there's something to worry about is called premature optimization and should be avoided. Do what makes the most sense, and then, and only then, if there's a performance issues, address it.
It is well known that selecting 100 column is much slower than selecting 10 cloumns
We are talking about hypothetical numbers here. Do we really know that the OP is dealing with such numbers ? It is always easier to choose the simplest solution and then chisel away at it if necessary.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How to select columns of a table dynamically?