Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating a table

Status
Not open for further replies.

ton9

Programmer
Apr 17, 2001
5
US
I am trying to update a table. I have on one page a form that gets all of its data from the DB. I can then make changes on that form then submit it to the next page which is the code I have included here. This second page should then update the DB and redirect to another page I specified. Problem is its not updating. I think the problem is the way I have the variables in the Update stmt line setup. I am not sure how to do this. Can someone please help!!!!! I am at my wits end. Thanks!


<%
Dim MLSnum, City, Price, Bedrooms, Bathrooms, Garagesize, Typeofprop, Intsize, View, Waterfront, Acres

'Grab the form data and assign it to variables...
MLSnum = Trim(Request.Querystring(&quot;MLS&quot;))
City = Trim(Request.Querystring(&quot;City&quot;))
Price = Trim(Request.Querystring(&quot;Price&quot;))
Bedrooms = Trim(Request.Querystring(&quot;Bedrooms&quot;))
Bathrooms = Trim(Request.Querystring(&quot;Bathrooms&quot;))
Garagesize = Trim(Request.Querystring(&quot;Garagesize&quot;))
Typeofprop = Trim(Request.Querystring(&quot;Proptype&quot;))
Intsize = Trim(Request.Querystring(&quot;Intsize&quot;))
Waterfront = Trim(Request.Querystring(&quot;Waterfront&quot;))
View = Trim(Request.Querystring(&quot;View&quot;))
Acres = Trim(Request.Querystring(&quot;Acres&quot;))

Dim SQL

SQL= &quot;UPDATE ME.RealEstateList SET city = ''&City&'' , bedrooms = '&Bedrooms&', bathrooms = '&Bathrooms&', garagesize = '&Garagesize&', typeofprop = '&Typeofprop&', intsize = '&Intsize&', waterfront = ''&Waterfront&'', hasView = ''&View&'', acres = ''&Acres&''
WHERE propertyID = 'MLSnum'&quot;

'Response.Write(SQL)
ConnOpen
Conn.Execute (SQL)
Conn.Close
Set Conn = nothing
Response.Redirect(&quot;searchMLS.asp&quot;)
%>
 
You do not write exactly what the trouble is. So i start guessing:
a) Use request.form( <field>)
b) If City is numeric, change SET city = ''&City&'' into
set city=&quot; & City & &quot;
if City is char, change it into
SET city = '&quot; & City & &quot;'

(and check the other fields too)

c) In this code there is no SET CONN=
d) ConnOpen is wrong: Conn.Open
br
Gerard
(-:

Better a known bug then a new release.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top