landslide
03-13-2007, 04:34 PM
Ok this is my problem. I have a page that pulls alot of records from a table and updates them all at the same time. They all have different values when updated. It works perfect but if thier are lot of records it will somtimes give me this message:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Could not update; currently locked by user 'admin' on machine 'server'.
I have to press submit mutiple times before it will update. Now I already check that no one else is in the database. I am the only one on this server and it does it at random only when I update a large number of records. Could it be my code? Please help! Thanks.
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="../../../Connections/lvcc.asp" -->
<%
var Recordset1 = Server.CreateObject("ADODB.Recordset");
Recordset1.ActiveConnection = MM_lvcc_STRING;
Recordset1.Source = "SELECT tblJanuary.SSN, tblJanuary.EOD, [tblJanuary.Last four], tblJanuary.firstname, tblJanuary.lastname, tblJanuary.ORGCODE, tblTollFreeEmployees.SCD, tblJanuary.SEID, tblJanuary.jan4, tblJanuary.extra2, tblJanuary.timestamp1 FROM tblJanuary, tblTollFreeEmployees WHERE [tblTollFreeEmployees.SEID] = [tblJanuary.SEID] and tblJanuary.jan4 LIKE ('R%')ORDER BY tblJanuary.EOD, SCD, [Last Four]";
Recordset1.CursorType = 0;
Recordset1.CursorLocation = 2;
Recordset1.LockType = 1;
Recordset1.Open();
var Recordset1_numRows = 0;
arjan4 = new Array();
arSeid = new Array();
var f=new Enumerator(Request.Form);
var el;
var start;
var len;
var idx;
for (; !f.atEnd(); f.moveNext()) {
el = f.item().toString().toLowerCase();
start = el.indexOf("_");
if(start > -1) {
start++; len = el.length - start;
idx = parseInt(el.substr(start, len));
if(!isNaN(idx)) {
if(el.indexOf("jan4")!=-1) arjan4[idx] = Request.Form(el);
if(el.indexOf("seid")!=-1) arSeid[idx] = Request.Form(el);
}
}
}
for(var i=0;i<arSeid.length;i++) {
if(arjan4[i] && arSeid[i]) {
updateDB (arjan4[i], arSeid[i]);
}
else {
Response.Write("");
}
}
function updateDB(param_jan4, param_seid) {
var update = Server.CreateObject("ADODB.Command");
update.ActiveConnection = MM_lvcc_STRING;
update.CommandText = update.CommandText = "UPDATE tblJanuary SET Jan4 = '" + param_jan4 + "' WHERE seid = '" + param_seid + "'";
update.CommandType = 1;
update.CommandTimeout = 0;
update.Prepared = true;
update.Execute();
}
var Repeat1__numRows = -1;
var Repeat1__index = 0;
Recordset1_numRows += Repeat1__numRows;
%>
<%
var Recordset2__MMColParam = "1";
if (String(Session("MM_Username")) != "undefined" &&
String(Session("MM_Username")) != "") {
Recordset2__MMColParam = String(Session("MM_Username"));
}
%>
<%
var Recordset2 = Server.CreateObject("ADODB.Recordset");
Recordset2.ActiveConnection = MM_lvcc_STRING;
Recordset2.Source = "SELECT LASTNAME, FIRSTNAME, SEID FROM Adminlogin WHERE SEID = '"+ Recordset2__MMColParam.replace(/'/g, "''") + "'";
Recordset2.CursorType = 0;
Recordset2.CursorLocation = 2;
Recordset2.LockType = 1;
Recordset2.Open();
var Recordset2_numRows = 0;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<!--
function doCalcs(form1){
count = form1.lvavalbl.value;
for(x=0; x<document.getElementsByName('jan4').length; x++){
document.getElementsByName('jan4')[x].value = (count > 0) ? 'A' : 'D'
count --;
}
}
//-->
</script>
<style type="text/css">
<!--
.style8 {
font-size: 24px;
font-weight: bold;
}
body {
background-color: #0099FF;
}
.style11 {font-weight: bold}
-->
</style>
</head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>jan4</title>
<style type="text/css">
<!--
.style7 {font-size: 9px}
.style9 {font-size: 10px}
.style10 {font-size: 12px}
-->
</style>
</head>
<body>
<p align="right"><a href="Jan5approve.asp">Click here to continue to the next day. </a></p>
<p align="center" class="style9">Approved by <span class="style11"><%=(Recordset2.Fields.Item("FIRSTNAME").Value)%> <%=(Recordset2.Fields.Item("LASTNAME").Value)%></span></p>
<form method="post" id="form1" name="form1" action="">
<p align="center" class="style8">January 4th </p>
<p align="center">Input the amount of leave that can be given
<input name="lvavalbl" type="text" id="lvavalbl" size="2" onblur="doCalcs(form1)"/>
</P>
<table border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><div align="center"><span class="style7">ID</span></div></td>
<td><div align="center"><span class="style7">EOD</span></div></td>
<td><div align="center"><span class="style7">SCD</span></div></td>
<td><div align="center"><span class="style7">Last four</span></div></td>
<td><div align="center"><span class="style7">First Name</span></div></td>
<td><div align="center"><span class="style7">Last Name</span></div></td>
<td><div align="center"><span class="style7">ORGCODE</span></div></td>
<td><div align="center"><span class="style7">SEID</span></div></td>
<td><div align="center"><span class="style7">jan4</span></div></td>
<td><div align="center"><span class="style7">timestamp1</span></div></td>
</tr>
<% while ((Repeat1__numRows-- != 0) && (!Recordset1.EOF)) { %>
<tr>
<td><span class="style7"><%=(Recordset1.Fields.Item("SSN").Value)%></span></td>
<td><span class="style10"><%=(Recordset1.Fields.Item("EOD").Value)%></span></td>
<td><span class="style10"><%=(Recordset1.Fields.Item("SCD").Value)%></span></td>
<td><span class="style7"><%=(Recordset1.Fields.Item("Last four").Value)%></span></td>
<td><span class="style10"><%=(Recordset1.Fields.Item("firstname").Value)%></span></td>
<td><span class="style10"><%=(Recordset1.Fields.Item("lastname").Value)%></span></td>
<td><span class="style7"><%=(Recordset1.Fields.Item("ORGCODE").Value)%></span></td>
<td><input name="seid_<%=Repeat1__index%>" type="text" id="seid_<%=Repeat1__index%>" value="<%=(Recordset1.Fields.Item("SEID").Value)%>" size="5" maxlength="5" readonly="<%=(Recordset1.Fields.Item("SEID").Value)%>" /></td>
<td><input name="jan4_<%=Repeat1__index%>" type="text" id="jan4" value="<%=(Recordset1.Fields.Item("jan4").Value)%>" size="4" /></td>
<td><span class="style7"><%=(Recordset1.Fields.Item("timestamp1").Value)%></span></td>
</tr>
<%
Repeat1__index++;
Recordset1.MoveNext();
}
%>
</table>
<p align="center">
<input name="Submit2" type="submit" value="Submit" />
</p>
</form>
</body>
</html>
<%
Recordset1.Close();
%>
<%
Recordset2.Close();
%>
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Could not update; currently locked by user 'admin' on machine 'server'.
I have to press submit mutiple times before it will update. Now I already check that no one else is in the database. I am the only one on this server and it does it at random only when I update a large number of records. Could it be my code? Please help! Thanks.
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="../../../Connections/lvcc.asp" -->
<%
var Recordset1 = Server.CreateObject("ADODB.Recordset");
Recordset1.ActiveConnection = MM_lvcc_STRING;
Recordset1.Source = "SELECT tblJanuary.SSN, tblJanuary.EOD, [tblJanuary.Last four], tblJanuary.firstname, tblJanuary.lastname, tblJanuary.ORGCODE, tblTollFreeEmployees.SCD, tblJanuary.SEID, tblJanuary.jan4, tblJanuary.extra2, tblJanuary.timestamp1 FROM tblJanuary, tblTollFreeEmployees WHERE [tblTollFreeEmployees.SEID] = [tblJanuary.SEID] and tblJanuary.jan4 LIKE ('R%')ORDER BY tblJanuary.EOD, SCD, [Last Four]";
Recordset1.CursorType = 0;
Recordset1.CursorLocation = 2;
Recordset1.LockType = 1;
Recordset1.Open();
var Recordset1_numRows = 0;
arjan4 = new Array();
arSeid = new Array();
var f=new Enumerator(Request.Form);
var el;
var start;
var len;
var idx;
for (; !f.atEnd(); f.moveNext()) {
el = f.item().toString().toLowerCase();
start = el.indexOf("_");
if(start > -1) {
start++; len = el.length - start;
idx = parseInt(el.substr(start, len));
if(!isNaN(idx)) {
if(el.indexOf("jan4")!=-1) arjan4[idx] = Request.Form(el);
if(el.indexOf("seid")!=-1) arSeid[idx] = Request.Form(el);
}
}
}
for(var i=0;i<arSeid.length;i++) {
if(arjan4[i] && arSeid[i]) {
updateDB (arjan4[i], arSeid[i]);
}
else {
Response.Write("");
}
}
function updateDB(param_jan4, param_seid) {
var update = Server.CreateObject("ADODB.Command");
update.ActiveConnection = MM_lvcc_STRING;
update.CommandText = update.CommandText = "UPDATE tblJanuary SET Jan4 = '" + param_jan4 + "' WHERE seid = '" + param_seid + "'";
update.CommandType = 1;
update.CommandTimeout = 0;
update.Prepared = true;
update.Execute();
}
var Repeat1__numRows = -1;
var Repeat1__index = 0;
Recordset1_numRows += Repeat1__numRows;
%>
<%
var Recordset2__MMColParam = "1";
if (String(Session("MM_Username")) != "undefined" &&
String(Session("MM_Username")) != "") {
Recordset2__MMColParam = String(Session("MM_Username"));
}
%>
<%
var Recordset2 = Server.CreateObject("ADODB.Recordset");
Recordset2.ActiveConnection = MM_lvcc_STRING;
Recordset2.Source = "SELECT LASTNAME, FIRSTNAME, SEID FROM Adminlogin WHERE SEID = '"+ Recordset2__MMColParam.replace(/'/g, "''") + "'";
Recordset2.CursorType = 0;
Recordset2.CursorLocation = 2;
Recordset2.LockType = 1;
Recordset2.Open();
var Recordset2_numRows = 0;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<!--
function doCalcs(form1){
count = form1.lvavalbl.value;
for(x=0; x<document.getElementsByName('jan4').length; x++){
document.getElementsByName('jan4')[x].value = (count > 0) ? 'A' : 'D'
count --;
}
}
//-->
</script>
<style type="text/css">
<!--
.style8 {
font-size: 24px;
font-weight: bold;
}
body {
background-color: #0099FF;
}
.style11 {font-weight: bold}
-->
</style>
</head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>jan4</title>
<style type="text/css">
<!--
.style7 {font-size: 9px}
.style9 {font-size: 10px}
.style10 {font-size: 12px}
-->
</style>
</head>
<body>
<p align="right"><a href="Jan5approve.asp">Click here to continue to the next day. </a></p>
<p align="center" class="style9">Approved by <span class="style11"><%=(Recordset2.Fields.Item("FIRSTNAME").Value)%> <%=(Recordset2.Fields.Item("LASTNAME").Value)%></span></p>
<form method="post" id="form1" name="form1" action="">
<p align="center" class="style8">January 4th </p>
<p align="center">Input the amount of leave that can be given
<input name="lvavalbl" type="text" id="lvavalbl" size="2" onblur="doCalcs(form1)"/>
</P>
<table border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><div align="center"><span class="style7">ID</span></div></td>
<td><div align="center"><span class="style7">EOD</span></div></td>
<td><div align="center"><span class="style7">SCD</span></div></td>
<td><div align="center"><span class="style7">Last four</span></div></td>
<td><div align="center"><span class="style7">First Name</span></div></td>
<td><div align="center"><span class="style7">Last Name</span></div></td>
<td><div align="center"><span class="style7">ORGCODE</span></div></td>
<td><div align="center"><span class="style7">SEID</span></div></td>
<td><div align="center"><span class="style7">jan4</span></div></td>
<td><div align="center"><span class="style7">timestamp1</span></div></td>
</tr>
<% while ((Repeat1__numRows-- != 0) && (!Recordset1.EOF)) { %>
<tr>
<td><span class="style7"><%=(Recordset1.Fields.Item("SSN").Value)%></span></td>
<td><span class="style10"><%=(Recordset1.Fields.Item("EOD").Value)%></span></td>
<td><span class="style10"><%=(Recordset1.Fields.Item("SCD").Value)%></span></td>
<td><span class="style7"><%=(Recordset1.Fields.Item("Last four").Value)%></span></td>
<td><span class="style10"><%=(Recordset1.Fields.Item("firstname").Value)%></span></td>
<td><span class="style10"><%=(Recordset1.Fields.Item("lastname").Value)%></span></td>
<td><span class="style7"><%=(Recordset1.Fields.Item("ORGCODE").Value)%></span></td>
<td><input name="seid_<%=Repeat1__index%>" type="text" id="seid_<%=Repeat1__index%>" value="<%=(Recordset1.Fields.Item("SEID").Value)%>" size="5" maxlength="5" readonly="<%=(Recordset1.Fields.Item("SEID").Value)%>" /></td>
<td><input name="jan4_<%=Repeat1__index%>" type="text" id="jan4" value="<%=(Recordset1.Fields.Item("jan4").Value)%>" size="4" /></td>
<td><span class="style7"><%=(Recordset1.Fields.Item("timestamp1").Value)%></span></td>
</tr>
<%
Repeat1__index++;
Recordset1.MoveNext();
}
%>
</table>
<p align="center">
<input name="Submit2" type="submit" value="Submit" />
</p>
</form>
</body>
</html>
<%
Recordset1.Close();
%>
<%
Recordset2.Close();
%>