re: dns db...

December 15, 2002 by Jee Wonder

Now that's a simple request.

Here's what you do. This may work for dsn.s but again dsn's are not considered fast.
I suggest you use Microsoft Jet OLEDB. Example below.

Dim strSite
strSite = strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("_db/pacific.mdb") & ";User id=";Password"=;"

The above is your connection file which will be an include file.

1. Create a file called lock.asp "or anything you desire"
2. Creat a table called dblock and a yes/no field called lock which is a checkbox.
3. Now the script will look as follows :-


<!-- #INCLUDE FILE="dbconn.asp" -->

<%@ language="VBScript" %>

<%
Option Explicit
Response.Expires =
0

Dim strSite
Dim
rs
Dim con

Set con = Server.CreateObject("ADODB.Connection")
con.Open
strSite

Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = strSite    "for ud users."


 Dim isLocked
 
 If CBool(Request.QueryString("lock")) Then
  con.Execute "INSERT INTO dblock VALUES (True);"
  isLocked = True
 Else
  con.Execute "DELETE FROM dblock;"
 End If
 
  
 If isLocked Then
  Response.redirect "locked.asp"
 Else
  Response.redirect "index.asp"

'           which is the main page on your site or if you have your site
'            setup like mne as a header include file."

 End If
 
 Response.End

%>

I hope this answers your request.

Errors

December 16, 2002 by Andrew Stevens

I had to delete the <%@ language="VBScript" %> as I already have @ in it already.

Now I get this error:

Microsoft VBScript compilation error '800a0400'

Expected statement

/index.asp, line 812

Option Explicit
^
Do I have to have a checkbox? I'd rather have it hidden. I'm sorry but I need a slightly more detailed explination.
I replaced the strSite with the name of my connection string for my sites's db.