NovoNordisk
asked on
Cant edit or submit to database
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?
Unspecified error. Does anyone have any ideas?
ASKER
It has full access!!
How do you insert or Update the data?
executing sql command? or using recordset?
executing sql command? or using recordset?
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
Jeff
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
(<>..<>)
Thanks
Jay Eire
(<>..<>)
ASKER
This is the page that inserts a new record:
<!--#include file="Connections/NoticeBo ard.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.ServerVariabl es("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|created by|value|t itle|value |type_ad|v alue|AdExp |value"
MM_columnsStr = "AdContent|',none,''|Place dBy|',none ,''|AdTitl e|',none,' '|AdType|' ,none,''|A dExp|',non e,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_field s(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.ActiveConnectio n = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnectio n.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editR edirectUrl )
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.appVe rsion.spli t("MSIE")[ 1]);
if (navigator.userAgent.index Of('Mac') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.index Of('Window s CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.index Of('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.gi f"></td>
<td colspan="3" align="default"><h4>Enter advert content below</h4></td>
<td align="default" width="0" height="0" background="images/right.g if"></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_m id.gif"></ td>
<td align="default" width="5%" background="images/split_m id.gif"></ td>
<td align="default" width="50%" background="images/split_m id.gif"></ td>
<td align="default" width="0" height="0"> <img src="images/split_right.gi f" width="13" height="11"></td>
</tr>
<tr>
<td align="default" width="0" height="0" background="images/left.gi f"></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('descripti on');
</script>
</div></td>
<td align="default" width="0" height="0" background="images/right.g if"></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_m id.gif"></ td>
<td align="default" width="5%" background="images/split_m id.gif"></ td>
<td align="default" width="50%" background="images/split_m id.gif"></ td>
<td align="default" width="0" height="0"> <img src="images/split_right.gi f" width="13" height="11"></td>
</tr>
<tr>
<td align="default" width="0" height="0" background="images/left.gi f"></td>
<td colspan="3" align="default"><input name="createdby" type="hidden" value="<%= Request.Cookies("Username" ) %>">
<%Response.write(Request.C ookies("us ername"))% > <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.g if"></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"> </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.
<!--#include file="Connections/NoticeBo
<%
' *** 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.ServerVariabl
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")
MM_editConnection = MM_NoticeBoard_STRING
MM_editTable = "Adverts"
MM_editRedirectUrl = "done.html"
MM_fieldsStr = "description|value|created
MM_columnsStr = "AdContent|',none,''|Place
' 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_field
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")
' 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
MM_editCmd.ActiveConnectio
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnectio
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editR
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"><
_editor_url = "WYSIWYG14/"; // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVe
if (navigator.userAgent.index
if (navigator.userAgent.index
if (navigator.userAgent.index
if (win_ie_ver >= 5.5) {
document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
document.write(' language="Javascript1.2"><
} else { document.write('<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 align="default" width="5%" background="images/top.gif
<td align="default" width="50%" background="images/top.gif
<td align="default" width="0" height="0"> <img src="images/top_right.gif"
</tr>
<tr>
<td align="default" width="0" height="0" background="images/left.gi
<td colspan="3" align="default"><h4>Enter advert content below</h4></td>
<td align="default" width="0" height="0" background="images/right.g
</tr>
<tr>
<td align="default" width="0" height="0"> <img src="images/split_left.gif
<td align="default" width="70%" background="images/split_m
<td align="default" width="5%" background="images/split_m
<td align="default" width="50%" background="images/split_m
<td align="default" width="0" height="0"> <img src="images/split_right.gi
</tr>
<tr>
<td align="default" width="0" height="0" background="images/left.gi
<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('descripti
</script>
</div></td>
<td align="default" width="0" height="0" background="images/right.g
</tr>
<tr>
<td align="default" width="0" height="0"> <img src="images/split_left.gif
<td align="default" width="70%" background="images/split_m
<td align="default" width="5%" background="images/split_m
<td align="default" width="50%" background="images/split_m
<td align="default" width="0" height="0"> <img src="images/split_right.gi
</tr>
<tr>
<td align="default" width="0" height="0" background="images/left.gi
<td colspan="3" align="default"><input name="createdby" type="hidden" value="<%= Request.Cookies("Username"
<%Response.write(Request.C
<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.g
</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 align="default" width="5%" background="images/bot.gif
<td align="default" width="50%" background="images/bot.gif
<td align="default" width="0" height="0"> <img src="images/bot_right.gif"
</tr>
</table>
<p>
<input type="hidden" name="MM_insert" value="form1">
</p>
</div>
</form>
<p align="center"> </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.
ASKER
The error on the above page points to line 113 which is:
MM_editCmd.ActiveConnectio n = MM_editConnection
MM_editCmd.ActiveConnectio
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.
ASKER
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!
You may have applied a new service pack to your SQL server requiring more permissions.
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.
ASKER
Im not using SQL server
you mentioned you got a Jet DB error... What are you using.
ASKER
Im using Microsoft Access as my DB
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.
-------------------------- ---------- ---------- ---------- ---------- ---------- ----
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.
--------------------------
ASKER
Still not working!!!
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks
Jay Eire
(<>..<>)