Solved

Cant edit or submit to database

Posted on 2004-10-18
19
157 Views
Last Modified: 2006-11-17
I have a few asp pages that dont do anything special at all.  I have pages that query an access database, and I also have pages that edit records and creates records.  The pages that query the DB, such as viewing all records, works perfectly.  However all of a sudden if I try to edit a record or insert a new one I get Microsoft JET Database Engine error '80004005'
Unspecified error.  Does anyone have any ideas?

0
Comment
Question by:NovoNordisk
  • 7
  • 5
  • 2
  • +4
19 Comments
 
LVL 7

Expert Comment

by:jay_eire
ID: 12338000
check that your IUSR_computername has read/write permissions to your .mdb file

Thanks
Jay Eire
(<>..<>)
0
 
LVL 8

Author Comment

by:NovoNordisk
ID: 12338006
It has full access!!
0
 
LVL 13

Expert Comment

by:nurbek
ID: 12338285
How do you insert or Update the data?

executing sql command? or using recordset?
0
 
LVL 9

Expert Comment

by:jmanGJHS97
ID: 12338527
Are you running this application in a domain?  I've run into a very similar situation in an application I wrote, and it turned out the issue was that the user logged into the machine was in a user group that did not have permission to write to the folder that housed the database.  You might make sure that the user is part of a group with permissions on the folder that the database is in.

Jeff
0
 
LVL 7

Expert Comment

by:jay_eire
ID: 12338752
it really sounds like a permissions problem....is there any line number given in the error message? if so can you post the code...

Thanks
Jay Eire
(<>..<>)
0
 
LVL 8

Author Comment

by:NovoNordisk
ID: 12338763
This is the page that inserts a new record:


<!--#include file="Connections/NoticeBoard.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "form1") Then

  MM_editConnection = MM_NoticeBoard_STRING
  MM_editTable = "Adverts"
  MM_editRedirectUrl = "done.html"
  MM_fieldsStr  = "description|value|createdby|value|title|value|type_ad|value|AdExp|value"
  MM_columnsStr = "AdContent|',none,''|PlacedBy|',none,''|AdTitle|',none,''|AdType|',none,''|AdExp|',none,NULL"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
 
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="Javascript1.2"><!-- // load htmlarea
_editor_url = "WYSIWYG14/";                     // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
 document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
 document.write(' language="Javascript1.2"></scr' + 'ipt>');  
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
// --></script>

</head>

<body>
<form name="form1" method="POST" action="<%=MM_editAction%>">
  <div align="center">
    <table align="center" cellpadding="0" cellspacing="0" border="0" width="100%">
      <tr>
        <td align="default" width="0" height="0"> <img src="images/top_left.gif" width="14" height="12"></td>
        <td align="default" width="70%" background="images/top.gif"></td>
        <td align="default" width="5%" background="images/top.gif"></td>
        <td align="default" width="50%" background="images/top.gif"></td>
        <td align="default" width="0" height="0"> <img src="images/top_right.gif" width="13" height="12"></td>
      </tr>
      <tr>
        <td align="default" width="0" height="0" background="images/left.gif"></td>
        <td colspan="3" align="default"><h4>Enter advert content below</h4></td>
        <td align="default" width="0" height="0" background="images/right.gif"></td>
      </tr>
      <tr>
        <td align="default" width="0" height="0"> <img src="images/split_left.gif"></td>
        <td align="default" width="70%" background="images/split_mid.gif"></td>
        <td align="default" width="5%" background="images/split_mid.gif"></td>
        <td align="default" width="50%" background="images/split_mid.gif"></td>
        <td align="default" width="0" height="0"> <img src="images/split_right.gif" width="13" height="11"></td>
      </tr>
      <tr>
        <td align="default" width="0" height="0" background="images/left.gif"></td>
        <td colspan="3" align="default"> <div align="left">
            <textarea name="description" cols="50" rows="8" id="textarea2"></textarea>
            <script language="JavaScript1.2" defer>
editor_generate('description');
</script>
          </div></td>
        <td align="default" width="0" height="0" background="images/right.gif"></td>
      </tr>
      <tr>
        <td align="default" width="0" height="0"> <img src="images/split_left.gif"></td>
        <td align="default" width="70%" background="images/split_mid.gif"></td>
        <td align="default" width="5%" background="images/split_mid.gif"></td>
        <td align="default" width="50%" background="images/split_mid.gif"></td>
        <td align="default" width="0" height="0"> <img src="images/split_right.gif" width="13" height="11"></td>
      </tr>
      <tr>
        <td align="default" width="0" height="0" background="images/left.gif"></td>
        <td colspan="3" align="default"><input name="createdby" type="hidden" value="<%= Request.Cookies("Username") %>">
          <%Response.write(Request.Cookies("username"))%> <input name="title" type="hidden" value="<%= Request.Form("title") %>">
          <input name="type_ad" type="hidden" value="<%= Request.Form("type_ad") %>">
          <input name="AdExp" type="hidden" value="<%= Request.Form("AdExp") %>">
          <input type="submit" name="Submit" value="Finish!"> </td>
        <td align="default" width="0" height="0" background="images/right.gif"></td>
      </tr>
      <tr>
        <td align="default" width="0" height="0"> <img src="images/bot_left.gif" width="14" height="14"></td>
        <td align="default" width="70%" background="images/bot.gif"></td>
        <td align="default" width="5%" background="images/bot.gif"></td>
        <td align="default" width="50%" background="images/bot.gif"></td>
        <td align="default" width="0" height="0"> <img src="images/bot_right.gif" width="13" height="14"></td>
      </tr>
    </table>
    <p>
      <input type="hidden" name="MM_insert" value="form1">
    </p>
  </div>
</form>
<p align="center">&nbsp;</p>
</body>
</html>

The Java script just ignore - this is for creating a popup calendar!!

I dont think it can be anything to do with what groups the logged on user is in.  The server is using anonymous access, and that account has all the appropriate permissions set.
0
 
LVL 8

Author Comment

by:NovoNordisk
ID: 12338772
The error on the above page points to line 113 which is:
 MM_editCmd.ActiveConnection = MM_editConnection
0
 
LVL 6

Expert Comment

by:Praesidium
ID: 12339871
Check the authorization method, and specify a specific account, if you haven't, on your connection string.  Then ensure that the account has the correct permissions on your SQL server.  
0
 
LVL 8

Author Comment

by:NovoNordisk
ID: 12345322
I can specify an account in my connection string, but it doesnt really need to have one.  Its never had one before so I dont know why its just stopped working!
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 6

Expert Comment

by:Praesidium
ID: 12348116
You may have applied a new service pack to your SQL server requiring more permissions.  
0
 
LVL 6

Expert Comment

by:Praesidium
ID: 12348138
I had an app do the same thing recently, seemed to closely follow the new service pack on the SQL Server.  I solved the issue by no longer using SSPI, and creating a specific account with the permissions I needed, and using that account in my connection string.  
0
 
LVL 8

Author Comment

by:NovoNordisk
ID: 12348235
Im not using SQL server
0
 
LVL 6

Expert Comment

by:Praesidium
ID: 12348259
you mentioned you got a Jet DB error...  What are you using.  
0
 
LVL 8

Author Comment

by:NovoNordisk
ID: 12348270
Im using Microsoft Access as my DB
0
 
LVL 6

Expert Comment

by:Praesidium
ID: 12348276
Oh... Access...  Er... use a real DB...  try this:

CAUSE
There are several causes for this error message: • The account that Microsoft Internet Information Server (IIS) is using (which is usually IUSR) does not have the correct Windows NT permissions for a file-based database or for the folder that contains the file.
• The file and the data source name are marked as Exclusive.
• Another process or user has the Access database open.
• The error may be caused by a delegation issue. Check the authentication method (Basic versus NTLM), if any. If the connection string uses the Universal Naming Convention (UNC), try to use Basic authentication or an absolute path such as C:\Mydata\Data.mdb. This problem can occur even if the UNC points to a resource that is local to the IIS computer.
• This error may also occur when you access a local Microsoft Access database that is linked to a table where the table is in an Access database on a network server.

RESOLUTION
The following items correspond to the previous list of causes: • Check the permissions on the file and the folder. Make sure that you have the ability to create and/or destroy any temporary files. Temporary files are usually created in the same folder as the database, but the file may also be created in other folders such as the WINNT folder. For additional information about how to identify which folder does not have the correct permissions and how to configure temporary files, click the following article number to view the article in the Microsoft Knowledge Base:
253604 Microsoft Access 97 database connectivity fails in Active Server Pages
If you use a network path to the database (UNC or mapped drive), check the permissions on the share, the file, and the folder.
• Verify that the file and the data source name (DSN) are not marked as Exclusive.
• The "other user" may be Microsoft Visual InterDev. Close any Visual InterDev projects that contain a data connection to the database.
• Simplify. Use a System DSN that uses a local drive letter. If necessary, move the database to the local drive to test.
• Follow the instructions in the following article to work around this problem:
189408 FIX: ASP fails to access network files under IIS 4.0 and IIS 5.0  

REFERENCES
To check for file access failures, use the Windows NT File Monitor. To download the File Monitor, see the following Sysinternals Web site:
http://www.sysinternals.com
Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.


--------------------------------------------------------------------------------
0
 
LVL 8

Author Comment

by:NovoNordisk
ID: 12431573
Still not working!!!
0
 
LVL 1

Expert Comment

by:triseros
ID: 12503426
NovoNordisk

Dreamweaver has a bug with Access that means that if you don't put a user id and password in the connection (even if the DB doesn't need one) it will sometime prevent updates stick in 'user' and 'password' in the user id and password fields and try that.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12752531
PAQed with no points refunded (of 500)

modulo
Community Support Moderator
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now