Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
06-20-2013, 12:41 PM #1
- Join Date
- Mar 2013
- Thanked 0 Times in 0 Posts
Display the query details in ASP page
I am using classic ASP code.
But i want to display the query result in page.
query is :strSQL1="select name from v$database"
I want to display the query result in page.
How can i pick those values and display in page.
please help me on this.
Last edited by ashok-n; 06-20-2013 at 12:46 PM.
06-20-2013, 07:26 PM #2
I don't think it is likely that your SQL query is correct:
The word after the from keyword must be the name of a TABLE in the database that your dbOA is connected to.Code:select name from v$database
And I don't know of any databases that allow a $ in the name of a table.
So here is a *GENERAL* answer that you will have to adapt to your specific table and fields:
In place of SELECT * you can use SELECT list,of,field,names where you choose the field names you want to see.Code:<!DOCTYPE html> <html> <body> <table border="1" cellpadding="3"> <% Set dbOA = Server.CreateObject("ADODB.COnnection") dbOA.Open "...your connection string..." strSQL1 = "SELECT * FROM sometableInYourDatabase" Set RS = dbOA.ExecuteSQL (strSQL1) ' write the names of all the fields at top of table: Response.Write "<tr>" & vbNewLine For f = 0 To RS.Fields.Count - 1 Response.Write "<th>" & RS.Fields(f).Name & "</th>" & vbNewLine Next Response.Write "</tr>" & vbNewLine ' now dump out the table: Do Until RS.EOF Response.Write "<tr>" & vbNewLine For f = 0 To RS.Fields.Count - 1 Response.Write "<td>" & RS.Fields(f).Value & "</td>" & vbNewLine Next Response.Write "</tr>" & vbNewLine RS.MoveNext Loop RS.Close dbOA.Close %> </table> </body> </html>
Last edited by Old Pedant; 06-20-2013 at 07:30 PM.
Be yourself. No one else is as qualified.