Re: Updating record EOF

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Ed Richter (erichter1_at_frontiernet.net)
Date: 03/15/05


Date: Tue, 15 Mar 2005 18:38:39 -0500

OK, that's what I thought you meant. Good idea?

Just curious though, I can understand how your suggestion would work, but
can you not use the EOF test in conjunction with a database update operation
like I tried to do?

"Thomas A. Rowe" <tarowe@mvps.org> wrote in message
news:eExaoFRKFHA.2136@TK2MSFTNGP14.phx.gbl...
>I would do something like the following:
>
> Set objRS = Server.CreateObject("ADODB.Recordset")
> strSQL = "SELECT * FROM Current_schedule WHERE (Sec_L_Name = '" &
> Rater_last & "' AND Home = '" & Home_team & "' AND G_Date = #" &
> Date_match & "# )"
> objRS.Open strSQL, objConn
>
> If Not objRS.EOF Then
> Set schObj = objConn.Execute ("UPDATE Current_schedule SET Post_2nd_Ref =
> '" & ref_ID & "' WHERE (Sec_L_Name = '" & Rater_last & "' AND Home = '" &
> Home_team & "' AND G_Date = #" & Date_match & "# ) ")
> End If
>
> objRS.close
> Set objRS = nothing
>
> --
> ==============================================
> Thomas A. Rowe (Microsoft MVP - FrontPage)
> WEBMASTER Resources(tm)
> http://www.ycoln-resources.com
> FrontPage Resources, WebCircle, MS KB Quick Links, etc.
> ==============================================
> To assist you in getting the best answers for FrontPage support see:
> http://www.net-sites.com/sitebuilder/newsgroups.asp
>
> "Ed Richter" <erichter1@frontiernet.net> wrote in message
> news:e8pc$pQKFHA.3484@TK2MSFTNGP12.phx.gbl...
>> So just reverse the order of the two lines?
>>
>> Do I first query for the record based on same criteria, if found execute
>> the update. If not found, then EOF? And by doing so, would place the EOF
>> (and query) ahead of the update?
>>
>>
>> "Thomas A. Rowe" <tarowe@mvps.org> wrote in message
>> news:eWOCUjQKFHA.1392@TK2MSFTNGP10.phx.gbl...
>>> You need to check for the record prior to doing the update. If the
>>> record exist, then do the do the update.
>>>
>>> --
>>> ==============================================
>>> Thomas A. Rowe (Microsoft MVP - FrontPage)
>>> WEBMASTER Resources(tm)
>>> http://www.ycoln-resources.com
>>> FrontPage Resources, WebCircle, MS KB Quick Links, etc.
>>> ==============================================
>>> To assist you in getting the best answers for FrontPage support see:
>>> http://www.net-sites.com/sitebuilder/newsgroups.asp
>>>
>>> "Ed Richter" <erichter1@frontiernet.net> wrote in message
>>> news:%23LwLdRQKFHA.656@TK2MSFTNGP14.phx.gbl...
>>> I'm attempting to update a record. The query was working OK, however
>>> there are some situations where a person may have entered some incorrect
>>> data, thus not finding a matching record. In case that happend I added
>>> the EOF statement and have added some code below to take care of what to
>>> do. However as soon as I added the EOF, I got the following error about
>>> object being closed?? If the schObj object is closed, I can't
>>> understand how it was open one line prior, before I added the EOF
>>> statement. Can you not use EOF when updating? Something else casuing
>>> the error?
>>>
>>> Set schObj = objConn.Execute ("UPDATE Current_schedule SET Post_2nd_Ref
>>> = '" & ref_ID & "' WHERE (Sec_L_Name = '" & Rater_last & "' AND Home =
>>> '" & Home_team & "' AND G_Date = #" & Date_match & "# ) ")
>>>
>>> line 221>> If schObj.EOF = true then
>>>
>>>
>>> ADODB.Recordset error '800a0e78'
>>>
>>> Operation is not allowed when the object is closed.
>>>
>>> /sports_ref_ratings/rating_submit.asp, line 221
>>>
>>>
>>
>>
>
>



Relevant Pages

  • Re: problem using FILE pointer
    ... feofonly signals that an EOF has been ... encounter EOF. ... this is the correct suggestion but the fscanf return value needs to be ... yet the declaration is a uint8. ...
    (comp.arch.embedded)
  • Re: problem using FILE pointer
    ... feofonly signals that an EOF has been ... encounter EOF. ... this is the correct suggestion but the fscanf return value needs to ... the fscanf format specifier is "%d". ...
    (comp.arch.embedded)
  • Re: Data order on response form
    ... Expression Web Resources: http://www.spiderwebwoman.com/xweb/ ... FrontPage Resources: http://www.spiderwebwoman.com/resources/ ... plus additional data about the virus protection ... "eofeofeof" so my import program can ignore everything after the 'EOF' ...
    (microsoft.public.frontpage.programming)
  • Re: ignore a line
    ... but I consider this to be overkill in this case. ... >portion) using the above program part you suggested ... This code skips to the end of line or EOF. ... Robert B. Clark's suggestion of reading the file line-wise (but note ...
    (comp.lang.c)
  • Re: ignore a line
    ... but I consider this to be overkill in this case. ... >portion) using the above program part you suggested ... This code skips to the end of line or EOF. ... Robert B. Clark's suggestion of reading the file line-wise (but note ...
    (alt.comp.lang.learn.c-cpp)