Results 1 to 2 of 2

Thread: Syntax error (missing operator) in query expression 'MsgDsc ='.

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Posts
    63
    Syntax error... can't figure it out...

    Here is the code:

    <%@ Language=VBScript %>

    <%

    set conn = server.createobject ("adodb.connection")
    conn.open "HYTECH"

    if not IsEmpty(Request.Form("NewsRem")) then
    conn.Execute "delete from NewsDB where MsgDsc = " & Request.Form("NewsRemove")
    elseif not IsEmpty(Request.Form("NewsUpd")) then
    Response.Redirect "./update.asp?EmployeeID=" & Request.Form("NewsUpdate")
    end if

    set RSNewsRemove = conn.Execute("select * from NewsDB ORDER BY Date ")
    Do Until RSNewsRemove.Eof
    OptionString = OptionString & "<OPTION VALUE=""" & RSNewsRemove("PostedBy") & """>" & RSNewsRemove("Date") & ", " & RSNewsRemove("MsgDsc") & "</OPTION>"
    RSNewsRemove.MoveNext
    Loop

    %>



    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    </HEAD>
    <BODY bgcolor="#FFFFFF">
    <form method="post" action="">
    <table width="500" border="0" cellspacing="5" cellpadding="5">
    <tr bgcolor="#CC0000">
    <td>
    <p><font face="Tahoma, Arial" color="#FFFFFF"><b>Product News (Admin)</b></font></p>
    </td>
    </tr>
    </table>
    <hr width="498" align="left">
    <table width="500" border="0" cellspacing="5" cellpadding="5" vspace="0">
    <tr valign="middle">
    <td width="199" height="40" bgcolor="#000000">
    <div align="right"><b><font face="Tahoma, Arial" color="#FFFFFF">
    <input type="submit" name="NewsAdd" value="Add News">
    </font></b></div>
    </td>
    <td width="264" height="40" bgcolor="#CCCCCC"><font face="Tahoma, Arial"></font></td>
    </tr>
    <tr valign="middle">
    <td width="199" height="40" bgcolor="#000000">
    <div align="right">
    <input type="submit" name="NewsUpd" value="Update News">
    </div>
    </td>
    <td width="264" height="40" bgcolor="#CCCCCC">
    <select name="NewsUpdate">
    </select>
    </td>
    </tr>
    <tr valign="middle">
    <td width="199" height="40" bgcolor="#000000">
    <div align="right"><b><font face="Tahoma, Arial" color="#FFFFFF">
    <input type="submit" name="NewsRem" value="Remove News">
    </font></b></div>
    </td>
    <td width="264" height="40" bgcolor="#CCCCCC"> <font face="Tahoma, Arial">
    <select name="NewsRem" style="color: #000080; text-transform: uppercase; font-size: 8pt; font-family: Arial; font-style: italic" size="1" >
    <% response.write OptionString %>
    </select>
    </font></td>
    </tr>
    <tr valign="middle">
    <td width="199" height="40" bgcolor="#000000">
    <div align="right"><b><font face="Tahoma, Arial" color="#FFFFFF">Current
    Date: </font></b></div>
    </td>
    <td width="264" height="40" bgcolor="#CCCCCC">
    <input type="text" name="textfield">
    </td>
    </tr>
    <tr valign="middle">
    <td width="199" height="40" bgcolor="#000000">
    <div align="right"><b><font face="Tahoma, Arial" color="#FFFFFF">Current
    Time: </font></b></div>
    </td>
    <td width="264" height="40" bgcolor="#CCCCCC"><font face="Tahoma, Arial">
    <input type="text" name="textfield2">
    </font></td>
    </tr>
    <tr valign="middle">
    <td width="199" height="40" bgcolor="#000000">
    <div align="right"><b><font face="Tahoma, Arial" color="#FFFFFF">Current
    Articles Posted: </font></b></div>
    </td>
    <td width="264" height="40" bgcolor="#CCCCCC"><font face="Tahoma, Arial">
    <input type="text" name="textfield3">
    </font></td>
    </tr>
    <tr valign="middle">
    <td width="199" height="40" bgcolor="#000000">
    <div align="right"><b><font face="Tahoma, Arial" color="#FFFFFF">Last
    Article Posted On: </font></b></div>
    </td>
    <td width="264" height="40" bgcolor="#CCCCCC"><font face="Tahoma, Arial">
    <input type="text" name="textfield4">
    </font></td>
    </tr>
    </table>
    <p> </p>
    </form>
    <p> </p>
    <P></P>

    </BODY>
    </HTML>

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I usually compose SQL into string before executing it so I can see exactly what is being passed to the database.

    Try doing that. Do you need ' around & Request.Form("NewsRemove")


    Do you do much ASP stuff?

    I'm certainly no ASP expert but it doesn't look quite right to me.

    Mark
    -------------------

Posting Permissions

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



Click Here to Expand Forum to Full Width