Print Page | Close Window

Setting textbox value from a database

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=14312
Printed Date: 30 March 2026 at 10:07am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Setting textbox value from a database
Posted By: reverett
Subject: Setting textbox value from a database
Date Posted: 19 March 2005 at 1:14am
Hello,
 
I am trying to use a read only textbox (input type=text) to display a value in an access database. I have found a way to do it but I'm wondering if a more experienced programmer may be suggest a better way:
 
Response.Write "<TD><INPUT TYPE='text' READONLY NAME='curname' MAXLENGTH='50' SIZE='42' VALUE='" & rsObject("coname") & "'</TD>"
 
Key interest is the VALUE= statement. Is there a better way to set the value from a database?
 
Thanks!



Replies:
Posted By: ub3rl337ch3ch
Date Posted: 20 March 2005 at 5:23pm
<input type="text" READONLY name="curname" maxlength="50" size="42" value="<%=rsObject("coname")%>">
 
or if that doesnt work, which it sometimes doesn't for me (no idea why):
 
<input type="text" READONLY name="curname" maxlength="50" size="42" value="<%Response.Write rsObject("coname")%>">


Posted By: Demon
Date Posted: 21 March 2005 at 1:59am
This should work:
Response.Write "<TD><INPUT TYPE=""text"" NAME=""curname"" MAXLENGTH=""50"" SIZE=""42"" VALUE=""" & rsObject("coname") & """ READONLY></TD>"

Microsoft got happy with quotation marks when making the ASP language. LOL


-------------
So Sayith the Demon.


Posted By: ub3rl337ch3ch
Date Posted: 21 March 2005 at 5:07pm
response.writing the whole lot is a waste of time. If you close your code tags beforehand (which i should have mentioned) and then repoen them after, the way i posted means less typing, and avoiding problems with delimiters etc...


Posted By: Demon
Date Posted: 21 March 2005 at 6:11pm
well, it all depends on what style of writing code you use :)

-------------
So Sayith the Demon.


Posted By: pmormr
Date Posted: 28 March 2005 at 8:53pm
actually... response.writing the whole bit is a little bit more efficient (on the server side because it doesn't have to go from ASP to HTML and then to ASP and back to HTML) but i would rather use a less complicated "spaghetti code" option then save myself 3 tenths of a millisecond.

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net