?
Solved

0x80040E21 update error?

Posted on 2005-03-22
14
Medium Priority
?
700 Views
Last Modified: 2012-06-22
I'm getting an error and it's driving me crazy...I get this error when trying to update info. on my MYSQL database.  The fields are varchar(255) with an id integer field:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
/brands/admin/submit.asp, line 36
 
 
<%
 

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("brands")

Set RS = Server.CreateObject("ADODB.Recordset")

id = Request.Form("id")
If Request.Form("remove") <> "" Then remove = true
If Request.Form("add") <> "" Then addit = true
 

If remove Then
      sql = "DELETE FROM brands WHERE id = " & id
      Conn.Execute(sql)
      Response.Redirect("default.asp?delete=1&name=" & Server.URLEncode(return_field))
Else

      If NOT errs Then
       
       If addit Then
                  RS.Open "brands", Conn, adOpenKeyset, adLockOptimistic, adCmdTable
                  RS.AddNew
            Else
                  sql = "SELECT * FROM brands WHERE id = " & id
                  RS.Open sql, Conn, adOpenKeyset, adLockOptimistic
       End If

          'RS.Fields("id") = Request.Form("id")
              RS.Fields("brand") = Trim(Request.Form("brand"))      <---------------------------LINE 36
              RS.Fields("logo") = Trim(Request.Form("logo"))
              RS.Fields("pof_icon") = Trim(Request.Form("pof_icon"))
              RS.Fields("best_practice1") = Trim(Request.Form("best_practice1"))
              RS.Fields("best_practice2") = Trim(Request.Form("best_practice2"))
              RS.Fields("best_practice3") = Trim(Request.Form("best_practice3"))
              RS.Fields("best_practice4") = Trim(Request.Form("best_practice4"))
              RS.Fields("rebate1_link") = Trim(Request.Form("rebate1_link"))
              RS.Fields("rebate1") = Trim(Request.Form("rebate1"))
              RS.Fields("rebate2_link") = Trim(Request.Form("rebate2_link"))
              RS.Fields("rebate2") = Trim(Request.Form("rebate2"))
              RS.Fields("rebate3") = Trim(Request.Form("rebate3"))
              RS.Fields("rebate4") = Trim(Request.Form("rebate4"))
              RS.Fields("foodguide1_link") = Trim(Request.Form("foodguide1_link"))
              RS.Fields("foodguide1") = Trim(Request.Form("foodguide1"))
              RS.Fields("foodguide2") = Trim(Request.Form("foodguide1"))
              RS.Fields("foodguide3") = Trim(Request.Form("foodguide1"))
              RS.Fields("caption") = Trim(Request.Form("caption"))
              RS.Fields("promo1") = Trim(Request.Form("promo1"))
              RS.Fields("promo2") = Trim(Request.Form("promo2"))
              RS.Fields("promo3") = Trim(Request.Form("promo3"))
              RS.Fields("description") = Trim(Request.Form("description"))
              RS.Fields("thumbnail") = Trim(Request.Form("thumbnail"))
              RS.Fields("tagline") = Trim(Request.Form("tagline"))
               
                       
             
         
               RS.Update
               RS.Close
            '*********************************
       
       If addit Then
                  Response.Redirect("default.asp?add=1&name=" & Server.URLEncode(return_field))
            Else
                  Response.Redirect("default.asp?edit=1&name=" & Server.URLEncode(return_field))
            End If
      End If
 End if
 

Set RS = nothing
Set fromWhere = Request.Form
%>

 

            <h3 class="bold"><% If addit Then%>Add<%Else%>Edit<%End If%>&nbsp;Article</h3>

            <table border="0">
                  <tr>
                        <td>
                              <%If errs Then%>
                                    <span class="bold" style="color:#FF0000">Please provide information for all required fields and check to make sure the information you provided is accurate.</span>
                                    <!--#include file="_form.asp"-->
                              <%End If%>
                        </td>
                  </tr>
            </table>

 

<%
Conn.Close
Set Conn = nothing

%>

If this matters, this is on the error page too:

Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Page:
POST 308 bytes to /brands/admin/submit.asp

POST Data:
id=&brand=Matty%27s+Fish+Sticks&tagline=&thumbnail=&pof_icon=&best_practice1=&best_practice2=&best_practice3=&best_practice4=&rebate1_link=&rebate1=&rebate2_link=&rebate2=&rebate3=&rebate4=&foodguide1 . . .
 
0
Comment
Question by:mattybrigh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
14 Comments
 
LVL 51

Expert Comment

by:Steve Bink
ID: 13601984
Perhaps:

       If addit Then
               RS.Open "brands", Conn, adOpenKeyset, adLockOptimistic, adCmdTable
               RS.AddNew                                             '<------------------ This is fine
          Else
               sql = "SELECT * FROM brands WHERE id = " & id
               RS.Open sql, Conn, adOpenKeyset, adLockOptimistic     '<------------------ But what about this branch?
       End If

Line 36 (since line 35 is commented...and SHOULD be since that tries to replace the key) begins updating a record from your recordset.  If addit=FALSE, the second branch is execute, which opens the recordset, but does not trigger an .AddNew or .Update method.  What is the state of your variables at that point?
0
 

Author Comment

by:mattybrigh
ID: 13602008
I guess I don't understand your question...the state of the variables?
0
 

Author Comment

by:mattybrigh
ID: 13602077
Essentially I use this same block of code which works fine with Access DB and SQL server - it's giving me a problem with the MySQL, though.  Would there be something in the MySQL control center that I'd need to change?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 51

Expert Comment

by:Steve Bink
ID: 13602334
Never mind, I did not see that you posted the state at the end of your question.  I'll learn to read some day.  :)

OK, according to your first post, Request.Form("remove") and Request.Form("add") are both NULL, since they were not listed in your POST list.  This means in your first IF statement, the code will fall through to the IF branch (since remove<>TRUE).  I did not see a reference to "errs", but I assume from the context it is boolean.  If it has not been set, it defaults to FALSE which means the second IF statement will flow through the main branch.  "addit" is FALSE (since the request variable "add" is not present), which means the third IF statement executes the ELSE branch.  This section is shown here:

       If addit Then
               RS.Open "brands", Conn, adOpenKeyset, adLockOptimistic, adCmdTable
               RS.AddNew
          Else
               sql = "SELECT * FROM brands WHERE id = " & id               <------------------- WE ARE HERE
               RS.Open sql, Conn, adOpenKeyset, adLockOptimistic
       End If

          'RS.Fields("id") = Request.Form("id")
            RS.Fields("brand") = Trim(Request.Form("brand"))      <---------------------------LINE 36
            RS.Fields("logo") = Trim(Request.Form("logo"))

If you look at your POST list, the request variable "id" is null, making your local variable "id" NULL as well.  This screws your SQL build, which now looks like this:

sql = "SELECT * FROM brands WHERE id = <null>"

Since [id] is likely the key field in that table, the recordset you open is not going to be populated (you can't have a record without a key, right?).  The next line to execute will attempt to update the [brand] field, for a non-existent record, AND without an rs.Edit statement to begin the process.

Which error would you like to start with?
0
 

Author Comment

by:mattybrigh
ID: 13602404
Makes sense (sort of)...Let's just start with the first error and go from there - your call as you most likely know how to fix this whereas I'm just staring at the screen! ;-)
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 13602612
Here's what you need to do:

1) Provide a value for Request.Form("id") from the previous page, OR account for a NULL value in the variable when building the SQL.
2) Add rs.Edit to the third IF's ELSE branch (the "WE ARE HERE" section from my last post).  It should appear after you have opened the recordset.
3) Define "errs" or otherwise provide a value for it.

An alternative to #1 is to disallow a NULL value for Request.Form("id") at the start of the page.  You should never try to use a key field when the possibility of a NULL value exists, since every record MUST have a unique value for the key.  When you assign the value to your local "id" variable, check for NULL/Empty, and redirect the user accordingly.

These fixes are meant only to fix this one branch.  As far as this code working fine with Access and MSSQL, I can only guess that during your tests, this particular part of the code was never executed.  Access and MSSQL have very little to do with the execution...the server would return the error.  Be sure to test every possible logic branch of your code.  The one you do not test is the one that fails later.
0
 

Author Comment

by:mattybrigh
ID: 13602844
Ok, in theory I understand what you mean, but I really don't know how to do what you want.  I just have this code that I got off some web site and have managed to modify it to suit my needs.  I suppose what I'm asking is if you could just post the changes in the code and I can cut/paste them to make it work for me.  

I'm all about learning how for the future, but time is kind of the essence for me right now...otherwise I'm totally lost.
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 13602971
The fix for #2 is easy:

       If addit Then
               RS.Open "brands", Conn, adOpenKeyset, adLockOptimistic, adCmdTable
               RS.AddNew
          Else
               sql = "SELECT * FROM brands WHERE id = " & id
               RS.Open sql, Conn, adOpenKeyset, adLockOptimistic
               RS.Edit        '<------------- The fix you need
       End If

#3 I have no idea.  You'll have to go through the code and see if you are even using the "errs" variable, how it is applied, what it is supposed to mean, etc.  For #1, it is a little more complicated.  From where do your users come to this page?  Whatever page they see before this, they should be selecting an ID to edit/add/delete.  Without that ID number, from what I can see, this page should not run AT ALL.  Instead, it should kick the user back to the previous page with an error message, or otherwise inform the user they did not supply an ID for the work.  Your code is obviously geared to delete the record, add a new record, or edit an existing one.  With delete or editing, you WILL need the ID of the record.  For adding, no problem, since the DB should provide that key value for you.

It sounds to me like you just need to understand more about the code and what it does.  Using someone else's code is always problematic because you enter into it not knowing exactly what they are doing.  You have to trace through it to understand the flow and how it works...then you'll be able to modify and tweak it to make it do exactly what you want.  IMHO, you can go back to the original author and tell him his code is incomplete and seriously lacks error handling and checking.
0
 

Author Comment

by:mattybrigh
ID: 13603026
Well, for #2 I get this error:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'RS.Edit'
/brands/admin/submit.asp, line 32

As for how they get there (and it's just me who'll be doing it) there's a default.asp page (I'm assuming this is what you're talking about)
<html>
 <head>
 <body bgcolor="#ffffff">
 <title>Admin - Main Page Postings</title>
 <link rel="stylesheet" href="../stylesheet.css">
 </head>


<a name="top"></a>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("brands")
sql = "SELECT * FROM brands order by brand"
Set RS = Conn.Execute(sql)
%>

 

<table border="0" class="text"><tr><td valign="top">
TO ADD a new Item - <a class="reviews" href="addedit.asp?add=1" class="bold">Click Here</a></td>
</tr>


<tr><td valign="top">
TO EDIT an Item -  
<%If RS.EOF Then%>
   <p class="errormsg">(None currently available to edit.)</p>
<%Else%>
    <span class="bold">Click on the Job Title</td></tr></table>
   <table border="0" cellpadding="3" cellspacing="0" width="100%" style="border: 1px solid #8097C0" class="text">
       <tr bgcolor="#E0E4ED">
        
             <td class="bold" style="border-bottom: 1px solid #8097C0">Thumbnail</td>
           <td class="bold" style="border-bottom: 1px solid #8097C0">Brand</td>
               <td class="bold" style="border-bottom: 1px solid #8097C0">Tagline</td>
               
                          
       </tr>
       <%
       bgcolor="#f0f0f0"
       Do While NOT RS.EOF' AND cnt < RS.PageSize
           If bgcolor="#f0f0f0" Then
               bgcolor=""
           ElseIf bgcolor = "" Then
                 bgcolor="#f0f0f0"
           End If
       %>
       <tr bgcolor="<%=bgcolor%>">
         <td valign="top"><%=RS("thumbnail")%></td>
         <td valign="top"><a href="addedit.asp?id=<%=RS("id")%>"><%=RS("Brand")%></a></td>
         <td valign="top"><%=RS("Tagline")%></td>
         </tr>
       <%
           RS.MoveNext
       Loop
       %>
   </table>

<%
End If 'If RS.EOF
%>

 

<%
RS.Close
Set RS = nothing
Conn.Close
Set Conn = nothing
%>
<br><br><div align="center">
<a href="#top">Back to Top</a></div>

Otherwise - I'm still lost.  I'm considering just hard coding the whole damn thing...
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 13603342
DOH!  My apologies.  The .Edit method is for DAO...a little different.  ADO should not need the line I added.  The problem must be limited to only the NULL id value.

This other page (default.asp) looks fine so far, and it definitely sends the ID value.  This snippet is from near the end of the page:

       <tr bgcolor="<%=bgcolor%>">
        <td valign="top"><%=RS("thumbnail")%></td>
' ----------VVVVVV  The next line is where the link for the editing is created.  When you load this page, you should be able to see the links
'                            as:  addedit.asp?id=<the id value for this record>
        <td valign="top"><a href="addedit.asp?id=<%=RS("id")%>"><%=RS("Brand")%></a></td>
        <td valign="top"><%=RS("Tagline")%></td>
        </tr>

Now that I see the first page, I can give a good guess as to why ID was NULL in the second page: you're using the wrong object to collect the data.  You're not using a form in default.asp, which means that Request.Form is an empty object.  Change the reference to Request.QueryString, and the ID should pop up with no problem.  Here's a change you can test on your addedit.asp page.  From the beginning of your code, change the lines as follows:

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("brands")

Set RS = Server.CreateObject("ADODB.Recordset")

id = Request.QueryString("id")
If Request.QueryString("remove") <> "" Then remove = true
If Request.QueryString("add") <> "" Then addit = true

If that seems to work, make that replacement everywhere you see Request.Form.  Your other option is to actually build the form instead...depending on your needs, that may or may not be the better option for you.


0
 

Author Comment

by:mattybrigh
ID: 13604348
Ok, I'm even more lost now that before (sorry, but when you don't really know how something works you get lost).  I'm posting all four of my pages (the actual form is an include file) and maybe you can just make changes where need be...as I'm about to call it quits (when things get difficult - I quit).

default.asp
=======
<!--#include virtual="/adovbs.inc"-->
 
 <html>
 <head>
 <body bgcolor="#ffffff">
 <title>Admin - Main Page Postings</title>
 <link rel="stylesheet" href="../stylesheet.css">
 </head>


<a name="top"></a>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("brands")
sql = "SELECT * FROM brands order by brand"
Set RS = Conn.Execute(sql)
%>

 

<table border="0" class="text"><tr><td valign="top">
TO ADD a new Item - <a class="reviews" href="addedit.asp?add=1" class="bold">Click Here</a></td>
</tr>


<tr><td valign="top">
TO EDIT an Item -  
<%If RS.EOF Then%>
   <p class="errormsg">(None currently available to edit.)</p>
<%Else%>
    <span class="bold">Click on the Job Title</td></tr></table>
   <table border="0" cellpadding="3" cellspacing="0" width="100%" style="border: 1px solid #8097C0" class="text">
       <tr bgcolor="#E0E4ED">
        
             <td class="bold" style="border-bottom: 1px solid #8097C0">Thumbnail</td>
           <td class="bold" style="border-bottom: 1px solid #8097C0">Brand</td>
               <td class="bold" style="border-bottom: 1px solid #8097C0">Tagline</td>
       </tr>
       <%
       bgcolor="#f0f0f0"
       Do While NOT RS.EOF' AND cnt < RS.PageSize
           If bgcolor="#f0f0f0" Then
               bgcolor=""
           ElseIf bgcolor = "" Then
                 bgcolor="#f0f0f0"
           End If
       %>
       <tr bgcolor="<%=bgcolor%>">
        <td valign="top"><%=RS("thumbnail")%></td>
        <td valign="top"><a href="addedit.asp?id=<%=RS("id")%>"><%=RS("Brand")%></a></td>
        <td valign="top"><%=RS("Tagline")%></td>
        </tr>

       <%
           RS.MoveNext
       Loop
       %>
   </table>

<%
End If 'If RS.EOF
%>

<%
RS.Close
Set RS = nothing
Conn.Close
Set Conn = nothing
%>
<br><br><div align="center">
<a href="#top">Back to Top</a></div>




addedit.asp
=======
<!--#include virtual="/adovbs.inc"-->
<link rel="stylesheet" href="../stylesheet.css">
 
 
<%
If Request.Form("add") <> "" OR Request.QueryString("add") <> "" Then addit = true
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("brands")

If NOT addit Then
    id = Request.QueryString("id")
    If id = "" Then id = Request.Form("id")
    Set RS = Server.CreateObject("ADODB.Recordset")
    sql = "SELECT * from brands WHERE id = " & CLng(id)
    RS.Open sql, Conn', adOpenKeyset, adLockPessimistic
      set fromwhere = RS
Else
      set fromWhere = Request.Form
End If
%>

 
<table border="0" class="text"><tr><td valign="top">
             <b><%If addit Then%>Add<%Else%>Edit<%End If%>&nbsp;Job Title - </b><a href="javascript:history.back()" class="reviews">Back to List</a>
</td></tr></table>


            <table border="0">
                  <tr>
                        <td>
                              <!--#include file="_form.asp"-->
                        </td>
                  </tr>
            </table>

 

<%
If NOT addit Then
    RS.Close
      Set RS = nothing
End If

Conn.Close
Set Conn = nothing

%>





_form.asp
=======
(this is actually much longer, but just so you get the jist of what it looks like)
<tr bgcolor="#f0f0f0">
       <td  valign="top" nowrap>Promo 3:</td>
       <td nowrap><input type="text" name="promo3" id="promo3"  maxlength="255" value="<%=fromWhere("promo3")%>"></td>
       <td width="100%">&nbsp;</td>
   </tr>
   <tr bgcolor="#8097C0">
       <td></td>
       <td colspan="2"><!--explanation text goes here--></td>
   </tr>
   
     
   <tr bgcolor="#8097C0">
       <td></td>
       <td colspan="2"></td>
   </tr>
   </tr>
   <%If NOT addit Then%>
   <tr>
       <td>&nbsp;</td>
       <td><br>
           <input type="submit" value="Edit Posting">
           </form>
           <form action="submit.asp" method="post" onSubmit="return confirm_delete()">
              <input type="hidden" name="id" id="id" value="<%=fromWhere("id")%>">
               <input type="submit" value="Delete Posting" name="remove"><br>
           </form>
       </td>
   </tr>
</table>
<%Else%>
   <tr>
       <td>&nbsp;</td>
       <td><br><input type="submit" name="add" value="Add Job Posting"></td>
   </tr>
</table>

</form>
<%End If%>






submit.asp
=======
<link rel="stylesheet" href="/stylesheet.css">

<!--#include virtual="/adovbs.inc"-->
 
 
<%
'return_field = Trim(Request.Form("headline"))

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("brands")

Set RS = Server.CreateObject("ADODB.Recordset")

id = Request.Form("id")
If Request.Form("remove") <> "" Then remove = true
If Request.Form("add") <> "" Then addit = true

If remove Then
      sql = "DELETE FROM brands WHERE id = " & id
      Conn.Execute(sql)
      Response.Redirect("default.asp?delete=1&name=" & Server.URLEncode(return_field))
Else

      If NOT errs Then
       
       If addit Then
               RS.Open "brands", Conn, adOpenKeyset, adLockOptimistic, adCmdTable
               RS.AddNew
          Else
               sql = "SELECT * FROM brands WHERE id = " & id
               RS.Open sql, Conn, adOpenKeyset, adLockOptimistic
               RS.Edit        '<------------- The fix you need
       
                  'sql = "SELECT * FROM brands WHERE id = " & id
                  'RS.Open sql, Conn, adOpenKeyset, adLockOptimistic
       End If

          'RS.Fields("id") = Request.Form("id")
              RS.Fields("brand") = Request.Form("brand")
              RS.Fields("logo") = Request.Form("logo")
              RS.Fields("tagline") = Request.Form("tagline")
              RS.Fields("pof_icon") = Request.Form("pof_icon")
              RS.Fields("best_practice1") = Request.Form("best_practice1")
              RS.Fields("best_practice2") = Request.Form("best_practice2")
              RS.Fields("best_practice3") = Request.Form("best_practice3")
              RS.Fields("best_practice4") = Request.Form("best_practice4")
              RS.Fields("rebate1_link") = Request.Form("rebate1_link")
              RS.Fields("rebate1") = Request.Form("rebate1")
              RS.Fields("rebate2_link") = Request.Form("rebate2_link")
              RS.Fields("rebate2") = Request.Form("rebate2")
              RS.Fields("rebate3") = Request.Form("rebate3")
              RS.Fields("rebate4") = Request.Form("rebate4")
              RS.Fields("foodguide1_link") = Request.Form("foodguide1_link")
              RS.Fields("foodguide1") = Request.Form("foodguide1")
              RS.Fields("foodguide2") = Request.Form("foodguide2")
              RS.Fields("foodguide3") = Request.Form("foodguide3")
              RS.Fields("caption") = Request.Form("caption")
              RS.Fields("promo1") = Request.Form("promo1")
              RS.Fields("promo2") = Request.Form("promo2")
              RS.Fields("promo3") = Request.Form("promo3")
              RS.Fields("description") = Request.Form("description")
              RS.Fields("thumbnail") = Request.Form("thumbnail")
             
         
             
         
               RS.Update
               RS.Close
            '*********************************
       
       If addit Then
                  Response.Redirect("default.asp?add=1&name=" & Server.URLEncode(return_field))
            Else
                  Response.Redirect("default.asp?edit=1&name=" & Server.URLEncode(return_field))
            End If
      End If
 End if
 

Set RS = nothing
Set fromWhere = Request.Form
%>

 

            <h3 class="bold"><% If addit Then%>Add<%Else%>Edit<%End If%>&nbsp;Article</h3>

            <table border="0">
                  <tr>
                        <td>
                              <%If errs Then%>
                                    <span class="bold" style="color:#FF0000">Please provide information for all required fields and check to make sure the information you provided is accurate.</span>
                                    <!--#include file="_form.asp"-->
                              <%End If%>
                        </td>
                  </tr>
            </table>

 

<%
Conn.Close
Set Conn = nothing

%>
 
0
 
LVL 51

Accepted Solution

by:
Steve Bink earned 1500 total points
ID: 13605528
When a user (i.e., you) starts the page, they will surf to default.asp.  This sets up the original connection:

Conn.Open Application("brands")

FYI: Application("brands") will be an application level object, most likely a DSN or other object providing connection-specific information.  As long the connection does not give you an error, you can leave this alone.  After the connection is open, the page displays all the brands (each with their own customized link), provides a link for adding a new brand, and closes the page.  Very basic and straight-forward.  One question...verify the existence of the file shown in this line:  <!--#include virtual="/adovbs.inc"-->

When a link is clicked on that page (either add or edit...delete is not present from the code you posted), the user is sent to the next page with a customized link.  The link appears as:

addedit.asp?id=x   <-- for an edit link, where 'x' is the id number of the brand the user clicked.
addedit.asp?add=1  <-- for the add link

The "?id=x" or "add=1" will go into a Request object called QueryString.  As we covered before, your code was originally testing for Request.Form, which was returning NULL values.  This is because default.asp did not use a form, and passed the parameters differently, as part of the URL.  In your most recent posting, you showed this change:

If Request.Form("add") <> "" OR Request.QueryString("add") <> "" Then addit = true

This is probably the better option, since no matter how the previous page sends the information (by form or by URL), it will still be picked up.  Generally, you should pick one method or the other and stick with it, or use Session variables, but that's a different conversation.  As addedit.asp continues, it includes the file _form.asp, which details the submit action (for at least one of the forms...keep reading) as submit.asp.  So we know that _form.asp is not a page in of itself, but a 'library', so to speak, of what goes into part of a page (addedit.asp, in this case).  The part of this file that you posted is woefully incomplete...there are at least 2 other forms on the page than the one shown in full in your excerpt.  Each form can have a different posting action, going to different pages.  I know the delete action from this page goes to submit.asp from this line:

          <form action="submit.asp" method="post" onSubmit="return confirm_delete()">
                    ^^^^^^^^^^^^   ^^^^^^^^^
                   where it goes               using this method

Finally we get to the page you originally asked about, submit.asp.  This page is expecting form data, which makes sense now that we know the page before it (addedit.asp) has a form.  It handles whichever action was selected on addedit.asp, then redirects the user back to default.asp with (assumably) some status information to be printed to the user.

There's a bit more to this project...this is just a basic flowchart.  The main idea is that you cannot test just one page.  These pages are meant to be used together and work off each other, starting with default.asp (I believe).  From your own admission, you are not very familiar with ASP, and starting out a project using someone else's code as a template without understanding what it does will not get you very far.  Every ASP project is different, and the code that works for one individual rarely works as-is, or even with minimal changes, for someone else.  Adapting code usually means some extensive reworking to make it work with your environment.  I highly recommend that you sit down and review what you can about this person's code...track through it and follow it line by line until you understand what it does.  If you hit a section you just can't comprehend, post a question here and someone will bring you up to speed with it.  If you do not have the time, resources, or patience to do that, then I recommend you find an outside developer to handle the project for you.  I certainly cannot build your project in this forum...even if you were able to give me all the necessary information about your DB, your project goals, connectivity, etc., it takes time I cannot dedicate.  We are, after all, just volunteers.
0
 
LVL 15

Expert Comment

by:gladxml
ID: 13608175
after this lines of code
          Else
               sql = "SELECT * FROM brands WHERE id = " & id
               RS.Open sql, Conn, adOpenKeyset, adLockOptimistic

try to add this

RS.Update



Also check check the link below might help..

http://www.adopenstatic.com/faq/80040e21.asp
http://support.microsoft.com/default.aspx?scid=kb;en-us;228935
0
 

Author Comment

by:mattybrigh
ID: 13623677
I just accepted that answer though my problem wasn't actually solved.  Anyway, thanks for everyone's help...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question