469,270 Members | 1,778 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

ASP.NET - How to display Recordset

384 256MB
I have the below code but i can't display the recordset, maybe i'm doing it way to complicated!?
Expand|Select|Wrap|Line Numbers
  1. <% DIM strDataSourceName, objConn
  2.  
  3. Set objConn = Server.CreateObject("ADODB.Connection")
  4.  
  5. strDataSourceName="Provider=SQLOLEDB;Data Source=localhost,1433;Network Library=DBMSSOCN;Initial Catalog=testdb;User ID=testuser;Password=12345678;"
  6.  
  7. objConn.connectionstring = strDataSourceName
  8. objConn.Open 
  9.  
  10. DIM mySQL
  11. mySQL = "SELECT message FROM message_tbl WHERE id=1"
  12.  
  13. DIM objRS
  14. Set objRS = Server.CreateObject("ADODB.Recordset")
  15. objRS.Open mySQL, objConn %>
  16. <html>
  17. <head>
  18. <title>ASP Test Page</title>
  19. </head>
  20. <body>
  21. <% response.write() %>
  22. </body>
  23. </html>
  24. <% objRS.Close
  25. objConn.Close %>
Oct 22 '08 #1
2 2735
GazMathias
202 Expert 128KB
You are not telling Response.Write what to write.

Try
Expand|Select|Wrap|Line Numbers
  1. Response.Write objRS("message")
or

Expand|Select|Wrap|Line Numbers
  1. <%=objRS("message")%>
Oct 22 '08 #2
jhardman
3,406 Expert 2GB
I'm confused, you say in your title that this is an ASP.NET question, yet you posted it in the "classic" ASP section, and the code sure looks like "classic" ASP written in VBScript. Perhaps the confusion stems from not knowing which version of ASP you are using.

Jared
Oct 23 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by bryan.com | last post: by
4 posts views Thread by seth_hickel | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.