help regarding delete for database

Results 1 to 5 of 5

Thread: help regarding delete for database

  1. #1
    Join Date
    Dec 1969
    Posts
    147

    Default help regarding delete for database

    hello:)<BR><BR>i had this error when executing a delete function:<BR><BR>VBscript error occured: <BR>error number=424<BR><BR>error descr.=Object required<BR><BR>help context=0<BR><BR>source=Microsoft VBScript runtime error<BR><BR>Database errors occured<BR><BR>DELETE * FROM AlumniNetwork where ID=<BR><BR>Error #-2147217900<BR><BR>error desc. -> [Microsoft][ODBC Microsoft Access 97 Driver] Syntax error (missing operator) in query expression &#039ID=&#039.<BR><BR><BR>the faulty line is:<BR><BR>SQLstmt = "DELETE * FROM AlumniNetwork where ID=" & ID<BR><BR><BR>is there something wrong with the line?<BR><BR>thanks <BR><BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: help regarding delete for database

    Well, what&#039s wrong is that the variable ID doesn&#039t hold any value. If you were to write:<BR><BR>Response.Write("ID = " & ID)<BR><BR>it would print out:<BR><BR>ID = <BR><BR>You are not initializing ID correctly. Are you getting it from a form from another page?

  3. #3
    Join Date
    Dec 1969
    Posts
    147

    Default RE: help regarding delete for database

    firstly thanks for replying:)<BR><BR>yes i pass the ID from another page.<BR><BR>can i send you both the scripts and let you take a look?<BR>i have had hard time solving it.<BR><BR>thanks a lot<BR><BR>karen<BR>

  4. #4
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: help regarding delete for database

    Go ahead and post the scripts here if they&#039re not too lengthy. What&#039s probably happening is either the variable is not being passed correctly, or you are not initializing the variable in the second asp page.


  5. #5
    Join Date
    Dec 1969
    Posts
    147

    Default RE: help regarding delete for database

    thanks:)<BR><BR>i have change the scripts a little and the error is now:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e10&#039 <BR><BR>[Microsoft][ODBC Microsoft Access 97 Driver] Too few parameters. Expected 1. <BR><BR>/del.asp, line 17 <BR><BR>the first script:<BR><BR>&#060;% <BR>myDSN="DSN=IMEMAILD;"<BR>mySQL="select * from AlumniNetwork"<BR>IDfield="AU_ID"<BR>scriptrespond er="del.asp"<BR><BR><BR>set conntemp=server.createobject("adodb.connection")<B R>conntemp.open myDSN<BR>set rstemp=conntemp.execute(mySQL)<BR>howmanyfields=rs temp.fields.count -1<BR>&#037;&#062;<BR><BR>&#060;table border="1"><BR> &#060;tr><BR> &#060;td valign="top">---&#060;/td><BR>&#060;% &#039Put Headings On The Table of Field Names<BR>for i=0 to howmanyfields &#037;&#062;<BR> &#060;td>&#060;b>&#060;%=rstemp(i).name &#037;&#062;&#060;/b>&#060;/td><BR>&#060;% next &#037;&#062;<BR> &#060;/tr><BR>&#060;% &#039 Now lets grab all the records<BR>do while not rstemp.eof &#037;&#062;<BR> &#060;tr><BR> &#060;td valign="top">&#060;%my_link=scriptresponder & "?which=" & rstemp(idfield)&#037;&#062;<BR>&#060;p>&#060;a HREF="&#060;%=my_link&#037;&#062;">delete&#060;/a>&#060;/td><BR>&#060;% for i = 0 to howmanyfields&#037;&#062;<BR> &#060;td valign="top">&#060;%=rstemp(i)&#037;&#062;<BR>&#06 0;/td><BR>&#060;% next &#037;&#062;<BR> &#060;/tr><BR><BR>&#060;%<BR>rstemp.movenext<BR>loop<BR>< BR>rstemp.close<BR>set rstemp=nothing<BR>conntemp.close<BR>set conntemp=nothing<BR>&#037;&#062;<BR><BR>the delete script:<BR><BR>set conn = server.createobject("adodb.connection")<BR>conn.op en "IMEMAILD"<BR>ID=request.querystring("which")<BR>< BR>&#039SQLstmt="DELETE * from AlumniNetwork where ID=" & ID<BR>SQLstmt = "DELETE * FROM AlumniNetwork where ID=&#039" & ID & "&#039"<BR><BR>Set Rs=conn.execute(SQLstmt)<BR><BR><BR>thanks again<BR><BR>karen<BR><BR><BR>

Posting Permissions

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