Updating Records

Results 1 to 5 of 5

Thread: Updating Records

  1. #1
    Slowbob Guest

    Default Updating Records

    Hey people,<BR><BR>I am sure most of you will have come across the below message when updating records in a database, even if you can&#039t tell me how to fix it, can you throw any light on what sometimes causes this message? Its driving me nuts: thanks guys.<BR><BR>ADODB.Field error &#039 800a0cb3&#039 <BR><BR>The operation requested by the application is not supported by the provider. <BR>

  2. #2
    Join Date
    Dec 1969

    Default Show code

    &nbsp;<BR>Suppose I told you <BR><BR>"My car isn&#039t running."<BR><BR>How would you answer me?<BR><BR>Yep, that&#039s how we have to answer your question. There are so MANY ways to get an error in ASP and ADO and VBS that nobody can diagnose a problem without seeing the code. You show us the code, maybe I&#039ll ship my car off to you.<BR><BR>

  3. #3
    Slowbob Guest

    Default RE: Show code

    &#060;% Dim SquadName, PlayerSlotID<BR> SquadName = Request.Cookies("RosterLogin")("SquadName")<BR> PlayerSlotID = Request.Form("PlayerSlotID")<BR>%&#062;<BR><BR>&#0 60;% Dim objConn<BR> Set objConn = Server.CreateObject("ADODB.Connection")<BR> objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _<BR> "DBQ=d:web-pagessubspacezone wleague
    oster.mdb"<BR> objConn.Open<BR>%&#062;<BR><BR>&#060;% Dim objRS, bolFound<BR> <BR> Set objRS = Server.CreateObject("ADODB.RecordSet")<BR> objRS.Open SquadName, objConn, , , adCmdTable<BR> bolFound = False<BR> <BR> Do Until objRS.EOF OR bolFound<BR> If (StrComp(objRS("PlayerSlotID"), PlayerSlotID, vbTextCompare) = 0 ) Then<BR> BolFound = True<BR> Else<BR> objRS.MoveNext<BR> End If<BR> Loop<BR> <BR> If Not bolFound Then<BR> objRS.Close<BR> Set objRS = Nothing<BR> objConn.Close<BR> Set objConn = Nothing<BR> Response.Write "Failed"<BR><BR> Else<BR> <BR> objRS("NickName") = "Empty"<BR> objRS("PlayerDateAdded") = Date<BR> objRS.Update<BR> <BR> objRS.Close<BR> Set objRS = Nothing<BR> objConn.Close<BR> Set objConn = Nothing<BR> End If<BR> <BR>%&#062;

  4. #4
    Join Date
    Dec 1969

    Default Code shown...2 things...

    Good!<BR><BR>Two things:<BR><BR>(1) objRS.Open SquadName, objConn, , , adCmdTable<BR><BR>Since you don&#039t supply values for two of those arguments, you get the system defaults. Which happen to be "Forward only cursor" and "Open this read only".<BR><BR>Can you say oops? Naturally, you can&#039t apply an Update to a record set that is opened for only reading. <BR><BR>(2) This is about the worst possible way to update a record. Sorry, but it&#039s true.<BR><BR>First, you have to rummage through possibly the entire table looking for a person who might not exist. Why? Why not just go *directly* to that record:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;query = "SELECT * FROM " & SquadName & " WHERE PlayerSlotID=&#039" & PlayerSlotId & "&#039"<BR><BR>and then<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;objRS.Open query, objConn, 3, 3, 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;If objRS.EOF Then ... no match ...<BR><BR>(sorry...too lazy to look up the mnemonics for those 3,3,1 values)<BR><BR>***************<BR><BR>Of course, if you *knew* that the slot existed in the DB, you could just do<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;query = "UPDATE " & SquadName & " SET Nickname=&#039Empty&#039, PlayerDateAdded=Date()" _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;& " WHERE PlayerSlotID=&#039" & PlayerSlotId & "&#039"<BR>&nbsp;&nbsp;&nbsp;&nbsp;objConn.Execute ( query )<BR><BR>and bypass the entire read-the-user exercise.<BR><BR>

  5. #5
    Slowbob Guest

    Default thanks *nt*


Posting Permissions

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