private 2D array
Hello,
I'm quite new to Java but am trying to build a website that uses SQL queries to perform user requests.
I'm trying to make a function that executes "select" type SQL queries (from a String paramater, 'qry') then executes it storing the results in a private 2D array in a tabular format.
Does anyone know how I can do this? I have imported the java.sql* library into the page and have already set up a connection and declared resultsets and so on...
Any help gratefully appreciated!
It sounds pretty straightforward to me. I know I probably wouldn't have thought so when I was a beginner myself, but there are plenty of examples of how to execute SQL select statements from within Java out there, and also some examples of using 2D arrays. Read something, and if you still have a question, please be more specific about it.
I read through this site which seems to do pretty much what I am after:
http://forum.java.sun.com/thread.jspa?threadID=615738&messageID=3872564
However, the example shows this working with 3 String parameters (that each go to make up an SQL statement) where as I just have one parameter, 'sql'.
I just cant get it to produce the 2D array for the results of this sql statement. The array needs to be interlaced with HTML table coding (<td><tr></tr><td>...) so that when the function is called from the main web page, the array is displayed as if it were a table.
I hope this makes sense, thanks for your help!!