473,583 Members | 3,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP with Access Database (Input Text - Value Display)

Hi,

I'm using Access Database with ASP. There is one particular thing that I
have issue with.
My purpose is for user to update their own profile. Their existing profile
information will be display in Edit Form format. The problem is if the field
has space, the second word will not display, when I display in input text
format.

E.g if My first name "User_FirstName " in my table has entry, let say "David
Johnson" as FirstName, when I execute following code and do a input text, it
will display "David" only.

I have following code.

<% Dim MyProfile

Set MyProfile= Server.CreateOb ject("ADODB.Con nection")
ConnStr = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & Server.MapPath
("database/users.mdb") & ";Jet OLEDB:Database Password=passwo rd"
MyProfile.Open( ConnStr)
SQLtemp = "SELECT * FROM UserAccount WHERE User_UserName = '" &
Request.Cookies ("UserName") & "' "
Set rs = MyProfile.Execu te(SQLtemp)

while not rs.eof

If Request.Cookies ("UserName") = rs("User_UserNa me") Then

dim Your_FirstName
Your_FirstName = rs("User_FirstN ame")
dim Your_LastName
Your_LastName = rs("User_LastNa me")
dim Your_UserName
Your_UserName = rs("User_UserNa me")
dim Your_Password
Your_Password = rs("User_Passwo rd")
dim Your_Email
Your_Email = rs("User_Email" )
dim Your_Address
Your_Address = rs("User_Addres s")
dim Your_City
Your_City = rs("User_City" )
dim Your_Country
Your_Country = rs("User_Countr y")
dim Your_Date_In
Your_Date_In = rs("User_EntryD ate")
dim Your_Company
Your_Company = rs("User_Compan y")
dim Your_Designatio n
Your_Designatio n = rs("User_Design ation")
dim Your_Phone
Your_Phone = rs("User_Phone" )
End If

rs.MoveNext
Wend
rs.Close
MyProfile.Close
set MyProfile = Nothing

%>

....
<td width="118" valign="top"><s pan class="bold">Fi rst
Name:</span></td>
<td width="624" valign="top"><i nput type="text" name="xFirstNam e"
size="20" value=<%respons e.write Your_FirstName %> maxlength="15"> </td>

.... This will display "David"

So, if I'm not using input type text to display is, for example,

<td width="118" valign="top"><s pan class="bold">Fi rst
Name:</span></td>
<td width="624" valign="top"><% response.write Your_FirstName %></td>
... This will display "David Johnson"
May I know why ? and how to fix it to display "David Johnson" in input text
format.

Thank you,

Regards,
Magix

Feb 12 '06 #1
2 2518
magix wrote:
...The problem is if the field has space, the second
word will not display, when I display in input text format...
That is usually because you aren't using attribute quotes.

<input type="text" name="xFirstNam e" size="20"
value=<%respons e.write Your_FirstName %>
maxlength="15">


Exactly. If you look at the generated HTML, you will see:

<input type="text" name="xFirstNam e" size="20"
value=David Johnson maxlength="15">

I suggest you change three things. The first is just a matter of
convenience:
• Use the <%= %> token for Response.Write
• Use attibute quotes
• Use Server.HTMLEnco de when writing something a user may have typed

In short, this will suffice:

<input value="<%=Serve r.HTMLEncode(Yo ur_FirstName)%> " ...>

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Feb 12 '06 #2
Thanks Dave. It works.

"Dave Anderson" <GT**********@s pammotel.com> wrote in message
news:11******** *****@corp.supe rnews.com...
magix wrote:
...The problem is if the field has space, the second
word will not display, when I display in input text format...
That is usually because you aren't using attribute quotes.

<input type="text" name="xFirstNam e" size="20"
value=<%respons e.write Your_FirstName %>
maxlength="15">


Exactly. If you look at the generated HTML, you will see:

<input type="text" name="xFirstNam e" size="20"
value=David Johnson maxlength="15">

I suggest you change three things. The first is just a matter of
convenience:
. Use the <%= %> token for Response.Write
. Use attibute quotes
. Use Server.HTMLEnco de when writing something a user may have typed

In short, this will suffice:

<input value="<%=Serve r.HTMLEncode(Yo ur_FirstName)%> " ...>

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.

Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

Feb 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
5396
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB 7.2 environment, the choices the optimizer makes often seem flaky. But this last example really floored me. I was hoping someone could explain why...
0
3717
by: TheCoder | last post by:
I am making a D-base with web conectivity for my class project. I have everything working but the subit button sends the data to the correct fields but afterwards it wants to reproduce new blank text boxes how do I stop this and how would I code it to redirect to a thank you page. All with out the help of a web server this has to br ran from...
0
3016
by: totierne | last post by:
comp.databases.ms-access, I want to know how to use Oracle views with session variables in Access. The parameterised views in access, are migrated to views with per session variables. The open questions: How to display a resultset
3
2760
by: Hutty | last post by:
I'm trying create a calendar control that updates an access database with events. I have some code I managed to piece together. First error I'm running into is the Mycommand.ExecuteNonQuery(). I get an error on this line as it looks for the query. Here's the first piece of the code where I'm able to get display calendar and the input...
2
6537
by: Robert Smith jr. | last post by:
Hello, Please pardon my newbie question ... I am building an ASP.NET page that displays a recordset with a Delete statement enabled (this all works fine). I want to Insert the current row *that is going to be deleted* into another table, before the original data is deleted. I am trying to use the RowDeleting method to call an Update...
9
3821
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. ...
7
5343
by: bhavin30 | last post by:
Is there a way to obtain user information (using LOGON_USER server variables) when you have set up the security to Anonymous Access? I have tried setting the security to both Anonymous + Window Integrated, without any luck. I'm using IIS 6.0 on Windows Server 2003 Thanks in advance!
2
3185
by: joecosmides | last post by:
I have a microsoft access front end and backend database for multi- user use. I have the back end located on a server that also is an IIS webserver. I've created a few ASP pages that pull customer lists down so far and it works great. I am trying to edit some of that data and noticed that a checkbox on the webpage uses ON/OFF instead of True/...
6
26296
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this one table. My problem is I have two buttons I want to use this code for for the two buttons would put the data in different tables. I have tried...
0
7895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8327
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7935
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8193
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5701
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1433
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.