+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 20

Thread: Syntax error near =

  1. #1
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Syntax error near =

    Hi All,

    Can someone see where I messed up? I was adding sPlanYr to the mix and now get error on line in red.
    Code:
    <%
    Dim sDistricts, sItemID, sPlanID, sPlanYr, sQ1, sQ2, sQ3, sQ4, sMyInputCost, sMyPlanDesc
    Dim rs, sSql
    Dim nCounter
    
    nCounter = 1
    
    sItemID = Request("ItemIDRow" & nCounter)
    sPlanID = Request("PlanID" & nCounter)
    sPlanYr = Request("PlanYr" & nCounter)
    do while len(sItemID) > 0
    
    sDistricts = Request("DistrictID")
    
    sQ1 = sZeroCheck(Request.Form("SQtr1" & nCounter))
    sQ2 = sZeroCheck(Request.Form("SQtr2" & nCounter))
    sQ3 = sZeroCheck(Request.Form("SQtr3" & nCounter))
    sQ4 = sZeroCheck(Request.Form("SQtr4" & nCounter))
    sMyInputCost = sZeroCheck(Request.Form("InputCost" & nCounter))
    sMyPlanDesc = Request.Form("InputItemDesc" & nCounter)
    %>
    
    <%
    
    Set rs = Server.CreateObject("ADODB.Recordset")
    
    'build SQL
    sSql = "update tblDetails set Qtr1 = " & sQ1 & ", Qtr2 = " & sQ2 & ", Qtr3 = " & sQ3 & ", Qtr4 = " & sQ4 & ", InputCost = convert(money, '" & sMyInputCost * 1000 & "'), PlanDesc = '" & ValidateStr(sMyPlanDesc) & "'"
    sSql = sSql & " WHERE ItemID=" & sItemID & " and DistrictID=" & sDistricts & " and PlanTypeID= " & sPlanID & " and PlanYr= " & sPlanYr & " "
    
    	rs.Open sSql, Conn, 3, 1
    
    nCounter = nCounter + 1
    sItemID = Request("ItemIDRow" & nCounter)
    Loop
    
    response.redirect "PlanDistResults.asp?DistrictID=" & sDistricts &  "&PlanYr=" & sPlanYr & "&PlanTypeID=" & sPlanID
    
    Conn.Close
    Set Conn = Nothing
    %>
    

  2. #2
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Hi All,

    If nothing is wrong with the syntax could it be the line in green below? If I remove line in green can I replace with line in orange?

    Code:
    <%
    Dim sDistricts, sItemID, sPlanID, sPlanYr, sQ1, sQ2, sQ3, sQ4, sMyInputCost, sMyPlanDesc
    Dim rs, sSql
    Dim nCounter
    
    nCounter = 1
    
    sItemID = Request("ItemIDRow" & nCounter)
    sPlanID = Request("PlanID" & nCounter)
    sPlanYr = Request("PlanYr" & nCounter)
    do while len(sItemID) > 0
    
    sDistricts = Request("DistrictID")
    sPlanYr = Requset("PlanYr")
    
    sQ1 = sZeroCheck(Request.Form("SQtr1" & nCounter))
    sQ2 = sZeroCheck(Request.Form("SQtr2" & nCounter))
    sQ3 = sZeroCheck(Request.Form("SQtr3" & nCounter))
    sQ4 = sZeroCheck(Request.Form("SQtr4" & nCounter))
    sMyInputCost = sZeroCheck(Request.Form("InputCost" & nCounter))
    sMyPlanDesc = Request.Form("InputItemDesc" & nCounter)
    %>
    
    <%
    
    Set rs = Server.CreateObject("ADODB.Recordset")
    
    'build SQL
    sSql = "update tblDetails set Qtr1 = " & sQ1 & ", Qtr2 = " & sQ2 & ", Qtr3 = " & sQ3 & ", Qtr4 = " & sQ4 & ", InputCost = convert(money, '" & sMyInputCost * 1000 & "'), PlanDesc = '" & ValidateStr(sMyPlanDesc) & "'"
    sSql = sSql & " WHERE ItemID=" & sItemID & " and DistrictID=" & sDistricts & " and PlanTypeID= " & sPlanID & " and PlanYr= " & sPlanYr & " "
    
    	rs.Open sSql, Conn, 3, 1
    
    nCounter = nCounter + 1
    sItemID = Request("ItemIDRow" & nCounter)
    Loop
    
    response.redirect "PlanDistResults.asp?DistrictID=" & sDistricts &  "&PlanYr=" & sPlanYr & "&PlanTypeID=" & sPlanID
    
    Conn.Close
    Set Conn = Nothing
    %>
    

  3. #3
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    What is the error that you're getting??
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  4. #4
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    This one:

    Code:
    Microsoft OLE DB Provider for SQL Server error '80040e14' 
    
    Line 1: Incorrect syntax near '='.
    
    This error is appearing when calling the Update asp page, and on Edit page I have the following:
    Code:
    <INPUT TYPE="hidden" NAME="DistrictID" readonly VALUE="<%= sDistricts %>">
    	<INPUT TYPE="hidden" NAME="PlanYr" readonly VALUE="<%= sPlanYr %>">
    	<INPUT TYPE="hidden" NAME="PlanID" readonly VALUE="<%= sPlanID %>">
    

  5. #5
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Add:
    Code:
    Response.Write sSql
    Response.End
    
    before you open the connection. Post the result here.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  6. #6
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Results:

    Code:
    update tblDetails set Qtr1 = 0, Qtr2 = 0, Qtr3 = 0, Qtr4 = 0, InputCost = convert(money, '0'), PlanDesc = '' WHERE ItemID=1 and DistrictID=4 and PlanTypeID= 1 and PlanYr=
    
    So why no year?

  7. #7
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    sPlanYr is not getting a value then and appears to be Blank or Nothing. To check, Response.Write after you Request it -- but I guessing it's no in the form vars.
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

  8. #8
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Well, no year because sPlanYr does not contain a value, which means Request("PlanYr" & ncounter) is not a valid Request item.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  9. #9
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Ok, when I use this line it shows the year:

    Code:
    sPlanYr = Request("PlanYr")
    
    Does it matter where it is? It is ok where I highlighted in orange on post#2?

  10. #10
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Why were you using the counter in the first place?
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Question ASP Upload syntax error (class aspform)
    By buck1109 in forum ASP Development
    Replies: 5
    Last Post: December 18th, 2009, 03:30 PM
  2. syntax error? Expected ')'
    By Rebelle in forum ASP Development
    Replies: 1
    Last Post: October 21st, 2008, 04:10 PM
  3. Syntax Error with Arrays
    By BLaaaaaaaaaarche in forum ASP Development
    Replies: 4
    Last Post: August 18th, 2008, 04:14 PM
  4. OleDbException: Syntax error (missing operator)
    By richyrich in forum SQL Development
    Replies: 2
    Last Post: July 24th, 2008, 07:37 AM
  5. syntax
    By Shem in forum .NET Development
    Replies: 1
    Last Post: July 9th, 2008, 06:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO