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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE Statement help

Status
Not open for further replies.

rjn2001

Programmer
Dec 29, 2004
172
GB
Hi, I am getting the following output from the ASP update statement.
however, the data is not being written to the DB, any hints?

Code:
UPDATE tblUsers SET tblUsers.[Password] = 'Nk9100' , tblUsers.E_Mail = 'richardn@davidmasonconsultancy.co.uk' , tblUsers.Sec_Ans = 'Alfred' , tblUsers.Post_Code = '' , tblUsers.First_Name = '' , tblUsers.Last_Name = '' , tblUsers.Birth_Year = '' , tblUsers.County = '' , tblUsers.Country = '' , tblUsers.Nationality = '' , tblUsers.Address = '39, Broadlands Road Meltham Holmfirth' , tblUsers.OtherPermit = '' , tblUsers.Required = '' , tblUsers.PersonTelephoneNoH = '' , tblUsers.PersonTelephoneNoW = '01484319112' , tblUsers.CareerDetail = 'I am a twat' , tblUsers.[URL unfurl="true"]www =[/URL] '' , tblUsers.Gender = '', tblUsers.Sec_ques = 'What is your Pet Name?' tblUsers.DistributionLogistics = '' tblUsers.ManOps = 'on' tblUsers.StratDev = 'on' tblUsers.AccountFin = '' tblUsers.CorpFin = 'on' tblUsers.ITDeploy = 'on' tblUsers.ITDesign = '' tblUsers.ITOther = '' tblUsers.Marketing = 'on' tblUsers.HumanResources = '' tblUsers.Sales = '' tblUsers.Purchasing = 'on' tblUsers.Automotive= 'on' tblUsers.ECommerce = 'on' tblUsers.Energy = 'on' tblUsers.FinServices = 'on' tblUsers.ITIndustry = '' tblUsers.LeisureIndustry = '' tblUsers.HealthIndustry = 'on' tblUsers.ManufacturingEngineering = 'on', tblUsers.NotForProfit = '' tblUsers.Publishing = '' tblUsers.Retail = 'on' tblUsers.Telecoms = 'on' tblUsers.TransportationIndustry = '' tblUsers.UtilityIndustry =

Richard Noon
 
You are missing comma's between the fields in the latter part of your query

-SecondToNone
 
yeah, thanks!, I have got them out now!

Code:
/Updateuser.asp, line 187 

strSQL = UPDATE tblUsers SET tblUsers.[Password] = '" & StrPassword & "' , tblUsers.E_Mail = '" & strEmail & "' , tblUsers.Sec_Ans = '" & strSec_Ans & "' , tblUsers.Post_Code = '" & strPost_Code & "' , tblUsers.First_Name = '" & strFirst_Name & "' , tblUsers.Last_Name = '" & strLast_Name & "' , tblUsers.Birth_Year = '" & strBirth_Year & "' , tblUsers.County = '" & strCounty & "' , tblUsers.Country = '" & strCountry & "' , tblUsers.Nationality = '" & strNationality & "' , tblUsers.Address = '" & strAddress & "' , tblUsers.OtherPermit = '" & strOtherPermit & "' , tblUsers.Required = '" & strRequired & "' , tblUsers.PersonTelephoneNoH = '" & strPersonTelephoneNoH & "' , tblUsers.PersonTelephoneNoW = '" & strPersonTelephoneNoW & "' , tblUsers.CareerDetail = '" & strCareerDetail & "' , tblUsers.[URL unfurl="true"]www =[/URL] '" & str[URL unfurl="true"]Www &[/URL] "' , tblUsers.Gender = '" & strGender & "', tblUsers.Sec_ques = '" & strSec_ques & "' , tblUsers.DistributionLogistics = '" & strDistributionLogistics & "' , tblUsers.ManOps = '" & strManOps & "' , tblUsers.StratDev = '" & strStratDev & "' , tblUsers.AccountCon = '" & strAccountCon & "' , tblUsers.CorpFin = '" & strCorpFin & "' , tblUsers.ITDeploy = '" & strITDeploy & "' , tblUsers.ITDesign = '" & strITDesign & "' , tblUsers.ITOther = '" & strITOther & "' , tblUsers.Marketing = '" & strMarketing & "' , tblUsers.HumanResources = '" & strHumanResources & "' , tblUsers.Sales = '" & strSales & "' , tblUsers.Purchasing = '" & strPurchasing & "' , tblUsers.Automotive= '" & strAutomotive & "' , tblUsers.ECommerce = '" & strECommerce & "' , tblUsers.Energy = '" & strEnergy & "' , tblUsers.FinServices = '" & strFinServices & "' , tblUsers.ITIndustry = '" & strITIndustry & "' , tblUsers.LeisureIndustry = '" & strLeisureIndustry & "' , tblUsers.HealthIndustry = '" & strHealthIndustry & "' , tblUsers.ManufacturingEngineering = '" & strManufacturingEngineering & "', tblUsers.NotForProfit = '" & strNotForProfit & "' , tblUsers.Publishing = '" & strPublishing & "' , tblUsers.Retail = '" & strRetail & "' , tblUsers.Telecoms = '" & strTelecoms & "' , tblUsers.TransportationIndustry = '" & strTransportationIndustry & "' , tblUsers.UtilityIndustry = "' & strUtilityIndustry & '" , tblUsers.Other = '" & strOther & "'  WHERE tblUsers.[UserID] = '" & strUserID & "'
---------------^

The arrow being under the strSQL = UPDATE tblUsers SET

That is the error code i get, there is something simple i know, but my brain is fried!

Richard Noon
 
for tblUsers.UtilityIndustry field you the quotes reserved. single quotes should be on the outer side

-SecondToNone
 
SOrry i meant to say...

for tblUsers.UtilityIndustry field your quotes are reversed. single quotes should be on the outer side

-SecondToNone
 
Hello, another problem, I cant figure out no more..
The output is this: (which all the fields are blank, and not being submitted to the DB)

Code:
UPDATE tblUsers SET tblUsers.[Password] = '' , tblUsers.E_Mail = '' , tblUsers.Sec_Ans = '' , tblUsers.Post_Code = '' , tblUsers.First_Name = '' , tblUsers.Last_Name = '' , tblUsers.Birth_Year = '' , tblUsers.County = '' , tblUsers.Country = '' , tblUsers.Nationality = '' , tblUsers.Address = '' , tblUsers.OtherPermit = '' , tblUsers.Required = '' , tblUsers.PersonTelephoneNoH = '' , tblUsers.PersonTelephoneNoW = '' , tblUsers.CareerDetail = '' , tblUsers.[URL unfurl="true"]www =[/URL] '' , tblUsers.Gender = '', tblUsers.Sec_ques = '' , tblUsers.DistributionLogistics = '' , tblUsers.ManOps = '' , tblUsers.StratDev = '' , tblUsers.AccountCon = '' , tblUsers.CorpFin = '' , tblUsers.ITDeploy = '' , tblUsers.ITDesign = '' , tblUsers.ITOther = '' , tblUsers.Marketing = '' , tblUsers.HumanResources = '' , tblUsers.Sales = '' , tblUsers.Purchasing = '' , tblUsers.Automotive= '' , tblUsers.ECommerce = '' , tblUsers.Energy = '' , tblUsers.FinServices = '' , tblUsers.ITIndustry = '' , tblUsers.LeisureIndustry = '' , tblUsers.HealthIndustry = '' , tblUsers.ManufacturingEngineering = '', tblUsers.NotForProfit = '' , tblUsers.Publishing = '' , tblUsers.Retail = '' , tblUsers.Telecoms = '' , tblUsers.TransportationIndustry = '' , tblUsers.UtilityIndustry = '' , tblUsers.Other = '' WHERE tblUsers.[UserID] = ''

Richard Noon
 
I dont see anything wrong with the query...and you cannot have [UserID] as null in the where clause...

The database should know the user id to update the fields for particular user id

-SecondToNone
 
Can you show us the code where you are retrieving your field values...

I am sure that you are getting your values from a form...

if you did you use Request("fieldname") thing??

-SecondToNone
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top