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

Syntax error in Update statement

Status
Not open for further replies.

Bodhi147

MIS
Jan 24, 2003
17
US
I can't figure out this error, please help. Its giving me a syntax error in my update statement at Set RS = Conn.Execute (SQLStmt)


if strIndex = "0" then

SQLStmt = ""
SQLStmt = "INSERT INTO Parts (PNumber, Grade, MfgGrade, Size, Weight, Offcuts, GradeType, FullBlockDivider,BaseGradePart,ProcessCode,NominalInches)"
SQLStmt = SQLStmt + " VALUES ('"+strNumber+"', '"+strGrade+"', '"+strMfgGrade+"', '"+strSize+"', "+strWeight+", '"+strOffcuts+"', "+strGradeType+", "+strFullBlockDiv+",'"+strMfgGradePart+"','"+strProcessCode+"','"+strNInches+"')"
else
SQLStmt = "Update Parts Set PNumber ='"+strNumber+"', Grade = '"+strGrade+"', MfgGrade = '" + strMfgGrade + "', "
SQLStmt = SQLStmt + "Size ='"+strSize+ "', Weight ="+strWeight+", Offcuts = '"+strOffcuts+"', GradeType = " + strGradeType + ", FullBlockDivider = " + strFullBlockDiv
SQLStmt = SQLStmt + ", BaseGradePart = '"+strMfgGradePart+"', ProcessCode = '" + strProcessCode + "', NominalInches = '" + strNInches + "', Where Index = "+strIndex

end if
'Response.Write SQLStmt
'Response.End
Set RS = Conn.Execute (SQLStmt)
conn.Close
set conn = nothing
set RS = nothing
 
I see the resposne.end.

can you post the output from that statement.

it will be easier to see the error (typo more then likely)

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
Update Parts Set PNumber ='03-0412', Grade = '2890', MfgGrade = 'No', Size ='540 x 540 x 1830', Weight =1184, Offcuts = 'Yes', GradeType = 1, FullBlockDivider = 1, BaseGradePart = '03-0136', ProcessCode = '03-5526', NominalInches = '21.5 x 21.5 x 72', Where Index = 73
 
last comma should be taken off
NominalInches = '21.5 x 21.5 x 72', <--
Where Index = 73

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
have you tested it in SQL View(Analyzer) in the DB yet?

you took this quote off right

+ strNInches + "', Where Index = "+strIndex



___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
My problem was that certain words are reserved and you can't use them. I just put brackets around all of them and it worked. Don't ask me why but it does. Thanks for your help though.

SQLStmt = "INSERT INTO Parts ([PNumber], [Grade], [MfgGrade], [Size], [Weight], [Offcuts], [GradeType], [FullBlockDivider], [BaseGradePart], [ProcessCode], [NominalInches])"
SQLStmt = SQLStmt + " VALUES ('"+strNumber+"', '"+strGrade+"', '"+strMfgGrade+"', '"+strSize+"', "+strWeight+", '"+strOffcuts+"', "+strGradeType+", "+strFullBlockDiv+", '"+strMfgGradePart+"', '"+strProcessCode+"', '"+strNInches+"')"
'Response.Write SQLStmt
'Response.End
else
SQLStmt = "Update Parts Set [PNumber] = '"+strNumber+"', [Grade] = '"+strGrade+"', [MfgGrade] = '" + strMfgGrade + "', "
SQLStmt = SQLStmt + "[Size] ='"+strSize+ "', [Weight] ="+strWeight+", [Offcuts] = '"+strOffcuts+"', [GradeType] = " + strGradeType + ", [FullBlockDivider] = " + strFullBlockDiv
SQLStmt = SQLStmt + ", [BaseGradePart] = '"+strMfgGradePart+"', [ProcessCode] = '" + strProcessCode + "', [NominalInches] = '" + strNInches + "' Where [Index] = "+strIndex

end if
'Response.Write SQLStmt
'Response.End
Set RS = Conn.Execute (SQLStmt)
 
Size was probably the bad apple

Glad you got it going

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top