Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Setting textbox value from a database
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Setting textbox value from a database

 Post Reply Post Reply
Author
reverett View Drop Down
Newbie
Newbie


Joined: 19 March 2005
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote reverett Quote  Post ReplyReply Direct Link To This Post Topic: Setting textbox value from a database
    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!
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post 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")%>">
Back to Top
Demon View Drop Down
Mod Builder Group
Mod Builder Group
Avatar
Mod-n-Skin Moderator

Joined: 26 July 2003
Status: Offline
Points: 299
Post Options Post Options   Thanks (0) Thanks(0)   Quote Demon Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post 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...
Back to Top
Demon View Drop Down
Mod Builder Group
Mod Builder Group
Avatar
Mod-n-Skin Moderator

Joined: 26 July 2003
Status: Offline
Points: 299
Post Options Post Options   Thanks (0) Thanks(0)   Quote Demon Quote  Post ReplyReply Direct Link To This Post Posted: 21 March 2005 at 6:11pm
well, it all depends on what style of writing code you use :)
So Sayith the Demon.
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.