0xC0000005
October 2nd, 2008, 09:27 AM
I use this function to update a record in my database:
function UpdateConnection(name, ip, port, type, tz)
{
objConn = Server.CreateObject("ADODB.Connection");
objConn.Open("Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:/Inetpub/wwwroot/xxx/xxx.mdb;");
var d = new Date();
var strDate = FormatDateString(d);
sqlUpdate =
"UPDATE [Connections] SET " +
"[ip]='" + ip + "', " +
"[port]='" + port + "', " +
"[type]='" + type + "', " +
"[register]='" + strDate + "', " +
"[logout]='', " +
"[tz]='" + tz + "' " +
"WHERE name='" + name + "'";
objConn.Execute(sqlUpdate);
objConn.Close();
}
Note that one of the fields is the date/time of the update.
But when I view the database immediately after the update, the date has not been updated:
function ShowDatabase()
{
objConn = Server.CreateObject("ADODB.Connection");
objConn.Open("Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:/Inetpub/wwwroot/xxx/xxx.mdb;");
objRS = objConn.Execute("SELECT * FROM [Connections] ORDER BY [register]");
%>
<table border="1" width="100%">
<tr>
<td>Name</td>
<td>IP</td>
<td>Port</td>
<td>Type</td>
<td>Register</td>
<td>Logout</td>
<td>TimeZone</td>
</tr>
<%
try{ objRS.MoveFirst(); }
catch(e){ }
while( !objRS.EOF )
{%>
<tr>
<td> <%=objRS("name")%> </td>
<td> <%=objRS("ip")%> </td>
<td> <%=objRS("port")%> </td>
<td> <%=objRS("type")%> </td>
<td> <%=objRS("register")%> </td>
<td> <%=objRS("logout")%> </td>
<td> <%=objRS("tz")%> </td>
</tr>
<% objRS.MoveNext();
}
%>
</TABLE>
<%
objConn.Close();
}
Clients who use this page essentially 'ping' it every minute or so. If a client pings the page for the first time the date/time will update. But if the client now sends a second, or third... etc. ping the date/time does not update.
If a second client pings the page, it will behave the same way. it's first ping will update the date/time, but not successive pings until the first client has pinged again.
In other words, this is what happens:
CLIENT 1 PING 1: DATE/TIME UPDATED
CLIENT 1 PING 2: DATE/TIME NOT UPDATED
CLIENT 1 PING 3: DATE/TIME NOT UPDATED
CLIENT 1 PING 4: DATE/TIME NOT UPDATED
A different scenario:
CLIENT 1 PING 1: DATE/TIME UPDATED
CLIENT 1 PING 2: DATE/TIME NOT UPDATED
CLIENT 1 PING 3: DATE/TIME NOT UPDATED
CLIENT 2 PING 1: DATE/TIME UPDATED
CLIENT 2 PING 2: DATE/TIME NOT UPDATED
CLIENT 2 PING 3: DATE/TIME NOT UPDATED
CLIENT 1 PING 4: DATE/TIME UPDATED
CLIENT 2 PING 4: DATE/TIME UPDATED
CLIENT 1 PING 5: DATE/TIME UPDATED
CLIENT 2 PING 5: DATE/TIME UPDATED
function UpdateConnection(name, ip, port, type, tz)
{
objConn = Server.CreateObject("ADODB.Connection");
objConn.Open("Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:/Inetpub/wwwroot/xxx/xxx.mdb;");
var d = new Date();
var strDate = FormatDateString(d);
sqlUpdate =
"UPDATE [Connections] SET " +
"[ip]='" + ip + "', " +
"[port]='" + port + "', " +
"[type]='" + type + "', " +
"[register]='" + strDate + "', " +
"[logout]='', " +
"[tz]='" + tz + "' " +
"WHERE name='" + name + "'";
objConn.Execute(sqlUpdate);
objConn.Close();
}
Note that one of the fields is the date/time of the update.
But when I view the database immediately after the update, the date has not been updated:
function ShowDatabase()
{
objConn = Server.CreateObject("ADODB.Connection");
objConn.Open("Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:/Inetpub/wwwroot/xxx/xxx.mdb;");
objRS = objConn.Execute("SELECT * FROM [Connections] ORDER BY [register]");
%>
<table border="1" width="100%">
<tr>
<td>Name</td>
<td>IP</td>
<td>Port</td>
<td>Type</td>
<td>Register</td>
<td>Logout</td>
<td>TimeZone</td>
</tr>
<%
try{ objRS.MoveFirst(); }
catch(e){ }
while( !objRS.EOF )
{%>
<tr>
<td> <%=objRS("name")%> </td>
<td> <%=objRS("ip")%> </td>
<td> <%=objRS("port")%> </td>
<td> <%=objRS("type")%> </td>
<td> <%=objRS("register")%> </td>
<td> <%=objRS("logout")%> </td>
<td> <%=objRS("tz")%> </td>
</tr>
<% objRS.MoveNext();
}
%>
</TABLE>
<%
objConn.Close();
}
Clients who use this page essentially 'ping' it every minute or so. If a client pings the page for the first time the date/time will update. But if the client now sends a second, or third... etc. ping the date/time does not update.
If a second client pings the page, it will behave the same way. it's first ping will update the date/time, but not successive pings until the first client has pinged again.
In other words, this is what happens:
CLIENT 1 PING 1: DATE/TIME UPDATED
CLIENT 1 PING 2: DATE/TIME NOT UPDATED
CLIENT 1 PING 3: DATE/TIME NOT UPDATED
CLIENT 1 PING 4: DATE/TIME NOT UPDATED
A different scenario:
CLIENT 1 PING 1: DATE/TIME UPDATED
CLIENT 1 PING 2: DATE/TIME NOT UPDATED
CLIENT 1 PING 3: DATE/TIME NOT UPDATED
CLIENT 2 PING 1: DATE/TIME UPDATED
CLIENT 2 PING 2: DATE/TIME NOT UPDATED
CLIENT 2 PING 3: DATE/TIME NOT UPDATED
CLIENT 1 PING 4: DATE/TIME UPDATED
CLIENT 2 PING 4: DATE/TIME UPDATED
CLIENT 1 PING 5: DATE/TIME UPDATED
CLIENT 2 PING 5: DATE/TIME UPDATED