473,513 Members | 2,275 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.CreateObject("ADODB.Connection")
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath
("database/users.mdb") & ";Jet OLEDB:Database Password=password"
MyProfile.Open(ConnStr)
SQLtemp = "SELECT * FROM UserAccount WHERE User_UserName = '" &
Request.Cookies("UserName") & "' "
Set rs = MyProfile.Execute(SQLtemp)

while not rs.eof

If Request.Cookies("UserName") = rs("User_UserName") Then

dim Your_FirstName
Your_FirstName = rs("User_FirstName")
dim Your_LastName
Your_LastName = rs("User_LastName")
dim Your_UserName
Your_UserName = rs("User_UserName")
dim Your_Password
Your_Password = rs("User_Password")
dim Your_Email
Your_Email = rs("User_Email")
dim Your_Address
Your_Address = rs("User_Address")
dim Your_City
Your_City = rs("User_City")
dim Your_Country
Your_Country = rs("User_Country")
dim Your_Date_In
Your_Date_In = rs("User_EntryDate")
dim Your_Company
Your_Company = rs("User_Company")
dim Your_Designation
Your_Designation = rs("User_Designation")
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"><span class="bold">First
Name:</span></td>
<td width="624" valign="top"><input type="text" name="xFirstName"
size="20" value=<%response.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"><span class="bold">First
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 2510
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="xFirstName" size="20"
value=<%response.write Your_FirstName %>
maxlength="15">


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

<input type="text" name="xFirstName" 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.HTMLEncode when writing something a user may have typed

In short, this will suffice:

<input value="<%=Server.HTMLEncode(Your_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**********@spammotel.com> wrote in message
news:11*************@corp.supernews.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="xFirstName" size="20"
value=<%response.write Your_FirstName %>
maxlength="15">


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

<input type="text" name="xFirstName" 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.HTMLEncode when writing something a user may have typed

In short, this will suffice:

<input value="<%=Server.HTMLEncode(Your_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
5387
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...
0
3714
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...
0
3011
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...
3
2757
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...
2
6533
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...
9
3816
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...
7
5340
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...
2
3182
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...
6
26280
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...
0
7265
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,...
0
7171
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...
1
7114
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...
1
5098
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...
0
3240
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3230
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
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...

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.