PDA

View Full Version : Little trouble with asp


Freon22
01-03-2003, 10:19 AM
Hi, All
I am one of those guys that knows enough to get into trouble.
So here I go, What I am trying to do is to be able to edit files in the data base.
But I cann't get the form part to work, I am sure I'm just over looking something just don't know what.
Here's the code, I hope someone out where can help and even
if you cann't thanks for trying.

<table cellspacing="10">
<tr>
<td><b>Owners Name</b></td>
<td><b>Date Sold</b></td>
<td><b>Unit Name</b></td>
<td><b>Unit Type</b></td>
<td><b>Date Installed</b></td>
<td><b>Sales Price</b></td>
<td><b>Cost</b></td>
<td><b>Profit</b></td>
<td><b>Salesman</b></td>
</tr>
<%
Do While (Not objRS.EOF and iCount < 5)
Response.Write "<tr><td>" & objRS("lastname") & "</td>"
Response.Write "<td>" & objRS("datesold") & "</td>"
Response.Write "<td>" & objRS("unitname") & "</td>"
Response.Write "<td>" & objRS("unittype") & "</td>"
Response.Write "<td>" & objRS("dateinstalled") & "</td>"
Response.Write "<td>$&nbsp;" & objRS("saleprice") & "</td>"
Response.Write "<td>$&nbsp;" & objRS("cost") & "</td>"
Response.Write "<td>$&nbsp;" & objRS("profit") & "</td>"
Response.Write "<td>" & objRS("salesman") & "</td>"
Response.Write "<td><form method=get action='editsales.asp'>
<input type=hidden name=number value=<%=objRS("number") %>>
<input type=submit value='edit'></form>" & "</td></tr>"
iCount = iCount + 1
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>

</table>

MikeParent
01-03-2003, 11:15 AM
Can you give us a link to the page so we can see what happens?

Off the top of my head though, it looks like the line that writes out your input tag is incorrect:

Response.Write "<td><form method=get action='editsales.asp'>
<input type=hidden name=number value=<%=objRS("number") %> >
<input type=submit value='edit'></form>" & "</td></tr>"


You are mixing references

<%= %> should not be used in a response.write statement in a script block, only use it inside an html block. It should be rewritten as:


Response.Write "<td><form method=get action='editsales.asp'>
<input type=hidden name=number value=" & objRS("number") & " >
<input type=submit value='edit'></form>" & "</td></tr>"

MikeParent
01-03-2003, 11:23 AM
Heh heh, beat ya David ;-)

MikeParent
01-03-2003, 11:28 AM
True, I opted for refraining from giving him any more info than he asked for, like reading the recordset into an array and how to condense those response.writes into 1 response.write using &_
:-)

Freon22
01-03-2003, 12:34 PM
Thank you, Thank you, too both of you guys.
I tryed it and it works great. Both of you have saved
the day for me. Just cann't say thanks enough.
Take Care & have a great day

MikeParent
01-03-2003, 01:40 PM
I've made the switch to PHP and it's much better!

Well we wont get into a discussion on that, but I will admit PHP is better for *some* things...