|
 |
asp_databases thread: Problem using text boexes to update a recordset
Message #1 by "Dirk Kinvig" <dirk.welsh@p...> on Fri, 28 Jul 2000 13:23:23
|
|
I am trying to update data in a table. To do this I want to insert the data
in the fields into text boxes which can then be amended as necessary.
However, I try to do this if the text in the field in the database contains
a space the text after that spacing does not get inserted into the
input-type "text box".
An example of the code is below.
If the job title is IT Manager only "IT" is displyed
Can anyone help??
Thanks in advance for reading this and heping!!
Dirk
<%
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "Select * From TblNames Where NameID = 2;"
objRS.Open strSQL, "DSN=Telephone 97"
%>
<Table>
<tr><td>Name</td><td><%=objRS("First Name")%></td></tr>
<TR><TD>Job Title</TD><TD><%=objRS("Job Title")%></td></TR>
<TR><TD>Update Job Title</TD><TD><Input Type="Text" Name="txtJob"
Value=<%=objRS("Job Title")%></TD></TR>
</Table>
Message #2 by "Fredrik Normen" <fredrik.normen@s...> on Sat, 29 Jul 2000 19:54:54
|
|
The problem lies here
Value=<%=objRS("Job Title")%>
You must have " around the value attribute..
So this would work:
<%
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "Select * From TblNames Where NameID = 2;"
objRS.Open strSQL, "DSN=Telephone 97"
%>
<Table>
<tr><td>Name</td><td><%=objRS("First Name")%></td></tr>
<TR><TD>Job Title</TD><TD><%=objRS("Job Title")%></td></TR>
<TR><TD>Update Job Title</TD><TD><Input Type="Text" Name="txtJob"
Value="<%=objRS("Job Title")%>"></TD></TR>
</Table>
/Fredrik Normén
Message #3 by "Imar Spaanjaars" <Imar@C...> on Mon, 31 Jul 2000 13:23:10
|
|
Hi Dirk,
Write the text between quotes, like this:
Value="<%=objRS("Job Title")%>"></TD></TR>
This should solve your problem.
To prevent other problems from happening, also make sure you close the
input tag.
The last > you use is the > from %> and not from the input tag.
Imar
At 01:23 PM 7/28/2000 +0000, you wrote:
> I am trying to update data in a table. To do this I want to insert the data
in the fields into text boxes which can then be amended as necessary.
However, I try to do this if the text in the field in the database
contains
a space the text after that spacing does not get inserted into the
input-type "text box".
An example of the code is below.
If the job title is IT Manager only "IT" is displyed
Can anyone help??
Thanks in advance for reading this and heping!!
Dirk
<%
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "Select * From TblNames Where NameID = 2;"
objRS.Open strSQL, "DSN=Telephone 97"
%>
<Table>
<tr><td>Name</td><td><%=objRS("First Name")%></td></tr>
<TR><TD>Job Title</TD><TD><%=objRS("Job Title")%></td></TR>
<TR><TD>Update Job Title</TD><TD><Input Type="Text" Name="txtJob"
Value=<%=objRS("Job Title")%></TD></TR>
</Table>
|
|
 |