Added: June/24/2007 at 9:16am | IP Logged
|
|
|
Hi, I am trying to update a users profile using ASP - the database is access. My problem is that my script returns the same result everytime and I am not sure on what to do now - with the absence of any error!
my asp script:
<% Dim Username,Salutation1,fname1,sname1,organisation_name,line1,l ine2,line3,line4,post_town,county,postcode,Country,tnumber1, mnumber1,email1 Username=request.form("username") Salutation= Request.Form("Salutation1") fname1=request.form("fname1") sname1=request.form("sname1") organisation_name=request.form("organisation_name") line1=request.form("line1") line2=request.form("line2") line3=request.form("line3") line4=request.form("line4") post_town=request.form("post_town") county=request.form("county") postcode=request.form("postcode") Country=request.form("Country") tnumber1=request.form("tnumber1") mnumber1=request.form("mnumber1") email11=request.form("email11") %> <% if username="" or Salutation1="" or fname1="" or sname1="" or line1="" or post_town="" or county="" or postcode="" or Country="" or tnumber1="" or mnumber1="" or email11="" then on error resume next Response.Write "A field was left empty, please try again!" if err.number <> 0 then response.write err.description Else set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open(Server.Mappath("mydatabase")) set rs=Server.CreateObject("ADODB.recordset") sql="SELECT DISTINCT Username FROM Address ORDER BY Username" rs.Open sql,conn Username=Session("username")
if Username<>"" or Salutation1="" or fname1="" or sname1="" or line1="" or post_town="" or county="" or postcode="" or Country="" or tnumber1="" or mnumber1="" or email11="" then sql= "Update Address Set Username='"& Username &"', Salutation1='"& Salutation1 & "',fname1='"& fname1 &"', sname1='"& sname1 &"',organisation_name='" & organisation_name &"', line1='" & line1 &"',line2='" & line2&"',line3='" & line3&"',line4='" & line4&"',post_town='" & post_town&"',county='" & county&"',postcode='" & postcode&"',Country='" & Country&"',tnumber1='" & tnumber1&"',mnumber1='" & mnumber1 &"', email11='" & email11&"' WHERE username=" & username Conn.Close Set Rs=Nothing Set Conn = Nothing
on error resume next Response.Write "Successfully Updated" if err.number <> 0 then response.write err.description
End If end if %>
The message that I get is:
A field was left empty, please try again!
I have entered data into all of the text fields on the update page.
How would I exclude a column from editing using the asp script?
Am I getting this error because the database holds more columns than I am trying to edit?
Regards
mal
__________________ If you can think of it! someone else will have already thought of and implemented the solution.
|