I am developing a simple web site in ASP. I have a web page which has a form, and I want to set the values of two text box to 2 fields selected by a query. One of the fields is a name field which has the First Name and the Last Name separated by a space. The text box only shows the First Name and not the last Name. Any idea how to show the complete field value? -
<%
-
Response.Expires = 0
-
Response.Cookies ("name")= ""
-
Response.Cookies ("Eid")= ""
-
Dim a,b,c,e,f,con,strQx,rs,strUrl,connectionString,nm,eid
-
-
a = Request.Form("t1")
-
b = Request.Form("t2")
-
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\My Documents\My Team\TM Testing\Team Details4.mdb;"
-
-
Set con = Server.CreateObject("ADODB.Connection")
-
con.Open connectionString
-
Set rs = Server.CreateObject("ADODB.Recordset")
-
strQx = "SELECT Users.NAME, Users.[EMP ID] FROM Users WHERE UserID='"&a&"' AND Password='"&b&"' "
-
rs.Open strQx,con, adOpenForwardOnly, adLockOptimistic
-
-
-
If rs.EOF Then
-
rs.close
-
Set rs = Nothing
-
con.close
-
Set con = Nothing
-
strUrl = "http://localhost/index.htm"
-
strUrl = strUrl & "?Error"
-
Response.Redirect strUrl
-
End If
-
-
c = rs("Name")
-
e = rs("EMP ID")
-
-
%>
-
<html>
-
-
<head>
-
<title>Online Tracker System</title>
-
</head>
-
-
<body onload=setfoc()>
-
-
<h1><font face="Calibri" size="6" color="#99FFCC"><b><img border="0" src="image3061.gif" width="377" height="114">Online
-
Tracker System </b></font><img border="0" src="image315.gif"></h1>
-
-
<form method="POST" name="f1" action="upload.asp">
-
<p align="left"><font face="Arial Rounded MT Bold"><font size="2">Week:</font> <select size="1" name="D1" tabindex="1">
-
<option>WK1</option>
-
<option>WK2</option>
-
<option>WK3</option>
-
<option>WK4</option>
-
<option>WK5</option>
-
</select> <font size="2">Date :</font> <input type="text" name="T1" size="17" onclick="OpenWin()" readonly tabindex="2">
-
<font size="2">Name:</font> <input type="text" name="T2" value=<%=rs("Name")%> size="37" readonly style="position: relative">
-
</form>
-
-
-
<script language ="JavaScript">
-
<!--
-
function setfoc()
-
{
-
document.f1.D1.focus();
-
}
-
-->
-
</script>
-
</body>
-
</html>
-
3 3224
The problem is that you did not put quotation marks around the value attribute of the input. - <input type="text" name="T2" value="<%=rs("Name")%>" size="37" readonly style="position: relative">
-
Suggestion: use the local variable you created "c" instead of the recordset object. - <input type="text" name="T2" value="<%=c%>" size="37" readonly style="position: relative">
-
jhardman 3,406
Recognized Expert Specialist
Azrar is right, but I think it is valid to use the recordset object there as he does in his first example. Think about this: the recordset object is already there, why bother having IIS create another variable to hold another value you already have a handle on?
In the future, a lot of these types of mistakes become really obvious when you look at the HTML code, this would have appeared like this in the HTML: - <input type="text" name="T2" value=Indrajit Chakraborty size="37" readonly style="position: relative">
Looking at it this way, it is pretty obvious what Azrar is saying.
Jared
Thanks for your reply Jared.
There are several reasons I suggested using a local variable instead of the recordset object:
1. he had already created local variable "c" in his code ( c = rs("Name") )
2. local variables are much lighter than recordset objects (less overhead). Accessing the value of a local variable is much faster than accessing the data in an object. If you need to access that data more than once in the script, it starts making a difference.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: ehm |
last post by:
I am working on creating an editable grid (for use in adding,
deleting, and editing rows back to an Oracle database). I have a JSP
that posts back to a servlet, which in turns posts to a WebLogic SFSB
and, from there, to the database.
On the front end, all cells appear as text fields. However, for
certain cells, when the user clicks on the cell, the text field turns
into a drop-down field (i.e. Select object), defaulting to the value...
|
by: d2bishop |
last post by:
Hi,
I am programmatically setting the .Text property of a number of Labels
on my Windows form at runtime, but I am experiencing some very strange
behaviour when I do this. The code I am using is below:
Label1.Text = "8 " & UCase(strOpen) 'strOpen = "Open"
|
by: Roy Adams |
last post by:
Hi Group
I'm trying to write from dynamically created hidden fields to a txt
field in the onchange event handler within a select.
basically the number for the for loop is generated by a field from a
db
which creates hidden fields populated by prices
once the onchange handler fires it sets the text for the text field
price and the hidden field Tsize, but I can't get it to set the txt of
oldprice from the hidden field prevprice.
|
by: Roy Adams |
last post by:
Hi I'm reposting this question because for some reason can't post
follow up question to this thread.
What I'm trying to do is put the value and text from a a select in to
a text field and to a hidden field respectfully and the value from
dynamically created hidden fiields in to a text fieldin to a text
field all at the same time
Here's the code as viewed through the browser
<body bgcolor="#FFFFFF" text="#000000" >
<SCRIPT...
|
by: Dixie |
last post by:
How can I programatically, take some Date/Time fields present in a table in
the current database and change their type to text?
dixie
| |
by: David |
last post by:
Hi,
I have a continuous form.
For each record I have a field 'HeldDate' (Text Field from a table)
Against each record I have a button which sets the visibility of this
text box to 'True' and does various other actions.
Is it possible to display the text box just for the current record,
rather than it displaying for all following records at the same time,
i.e. set visibility to true where record id - xxx
|
by: FP |
last post by:
I'm new to Java Script.
I'm displaying comments people have made. Below each persons' comment
I want to add 2 buttons "Reply" and "Amend". Clicking "Reply" would
display an empty text field below the comment with a spell check &
submit button. Clicking "Amend" would display the same buttons & text
field but pre-populated with the original comment.
Using Java Script how do I show / hide the text field in my list of
comments but have...
|
by: umeshkakade |
last post by:
I have used mdb with 4 fields - rollno, name, date & attendance.
I have design a form for data entry by considering above fields.
I have connected it to DAO database object.
Suppose I have saved data with following values
roll = 1 & date = 15/12/2006
now, I want to write code which avoid duplicate entry i.e user could’nt save record with same values ie roll = 1 & date = 15/12/2006.
|
by: AccessHunter |
last post by:
Please help....
I am trying to JOIN two tables, Table1 and Table2,
the fields used for the JOIN are Table1.CaseNum (Number field) and Table2.Casetxt (Text field).
I know it will not let me do the JOIN between Number field and Text field and for that I should have a query to do the Text to Integer conversion before I try the JOIN Query.
I would like to know if the following is possible
I want to do 2 things in the same Query,
...
|
by: parry2k |
last post by:
I have one view with 3 fields like the view name is myview and it has following sql statement.
select fn,ln,city from tablea
I created a function like below:-
create function myfun(in t myview, in f varchar(50)) returns varchar(100) as
Now i want to pass row and name of field and let it return the value from function on basis of field name i pass to the function like
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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 we have to send another system
|
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |