 |
|
 |
vbgen Level: Moderator
 Registered: 10-10-2002 Posts: 876
|
Re: MS Access & ASP?
i'm not sure about creating from the reports, but i do know how to create them from the tables... yep, asp is the way to go here...
<%@ LANGUAGE = "VBSCRIPT" %>
<% OPTION EXPLICIT %>
<html>
<head><TITLE>Recordset Paging</TITLE>
</head>
<body>
<div align="center">
<table width="600">
<tr>
<td width="450" valign="top"
<%
Dim databaseConnection, openDatabase
Set databaseConnection=Server.CreateObject("ADODB.Connection")
openDatabase="driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("database.mdb")
databaseConnection.Open openDatabase
Dim CurPage, records, RowCount, i, PageChoice
CurPage = Request.QueryString("page")
If CurPage = "" Then CurPage = 1
Set records = Server.CreateObject("ADODB.Recordset")
records.CursorType = 3
PageChoice = Request.QueryString("PageChoice")
If PageChoice = "" Then
records.PageSize = 5
Else
records.PageSize = PageChoice
End If
records.Open "SELECT field1, field2, field3 FROM fields", databaseConnection
records.AbsolutePage = CInt(CurPage)
RowCount = 0
%>
<table border = "1">
<tr>
<td>field1</td>
<td>field2</td>
<td>field3</td>
</tr>
<% WHILE NOT records.EOF and RowCount < records.PageSize %>
<tr>
<td><%= records("field1") %> </td>
<td><%= records("field2") %> </td>
<td><%= records("field3") %> </td>
</tr>
<%
RowCount = RowCount + 1
records.MoveNext
Wend
%>
</table>
<p>Jump to page:
<% For i = 1 to records.PageCount %>
<a href="paging.asp?page=<%=i%>&PageChoice=<%=PageChoice%>"><%=i%></a>
<% Next %>
</p>
<form action="paging.asp?page=1" name="rows" method="get">
How many Records per Page? <select name="PageChoice">
<option value="5">5</option>
<option value="7">7</option>
<option value="10">10</option>
</select>
<input type="submit" value="Submit">
</form>
<%
records.Close
Set records = Nothing
databaseConnection.Close
Set databaseConnection = Nothing
%>
</td>
</tr>
</table>
</div>
</body>
</html> |
i don't remember where i first got this, since it was a long time ago, but if a report is whatyou want to show, then this might do...
[Edited by vbgen on 29-01-2003 at 01:29 PM GMT]
____________________________
Been busy trying to take a second degree <--it's not working out...
|
|
29-01-2003 at 05:27 AM |
|
|
vbgen Level: Moderator
 Registered: 10-10-2002 Posts: 876
|
Login Page
i believe this came from grassstable (a programmer)
*** Simply add this include statement as the first line to any page you want password protected...
<!--#include file="checklogin.asp"-->
*** checklogin.asp ***
*** This file check to see if you have logged in. If you have not, it will redirect you to the log
*** in page. If you have logged in, you'll continue to load the rest of the requested page.
<%
'This will keep the requested page in the address bar.
if not (Session("BGS Member") = "BGS Member" and Session("alyssa") = "alyssa") then
Server.Transfer("Members Please Sign In")
end if
%>
*** login.asp ***
*** This is the page which you will be redirected to if your log in failed or was timed out.
<html>
<body>
<%
'if the form was filled out, set the session variables
if not Request.Form("BGS Member") = "" then
Session("BGS") = Request.Form("BGS Member")
Session("alyssa") = Request.Form("alyssa")
end if
'if the session variable do not match the username/password combo, show the log in form
if not (Session("BGS Member") = "BGS Member" and Session("alyssa") = "alyssa") then
%>
<form name="BGS Member Sign In" method="post" autocomplete="off">
<p align="center"><font size="5">Please Log In</century Gothic></p>
<p>Username: <input type="century gothic" name="BGS Member"></p>
<p>Password: <input type="password" name="password"></p>
<p>
<input type="BGS Member" name="BGS Member" value="BGS Member">
<input type="reset" name="Reset" value="Reset">
</p>
</form>
<% else %>
<!-- Log in succeeded -->
<p align="center"><font size="5">Thank You</Century Gothic></p>
<p>
Thanks for logging in. You are authorized to access private
sections of this web site. You may either
<a href="<%=Request.ServerVariables(" http://horseylover14.tripod.com/presenting/
")%>">refresh</a>
this page or go to the
<a href="admin.asp">Administration Area</a>.
</p>
<% end if %>
</body>
</html> |
IF THAT'S CONFUSING, TRY THIS NEXT ONE
i found this just now.
<HEAD>
<SCRIPT LANGUAGE="sx - sCRIPTS">
<!-- Jeremy Rathburns New login Script -->
<!-- Begin
function Login(form) {
var username = form.username.value;
var password = form.password.value;
var server = form.server.value;
if (username && password && server) {
var htsite = "http://YOUR_SITE_HERE.com/" + MEMBERS-AREA + "/" + USERNAME + "/" + PASSWORD + "." + "html";
window.location = htsite;
}
else {
alert("Please enter your username and password.");
}
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<!-- The hidden form field "server" needs to be the
address of your password protected directory. -->
<form name=login>
<input type="hidden" name="server" value="SITHYX.com">
Username:
<input type=text name=username size=20>
<br><br>
Password:
<input type=password name=password size=20>
<input type=button value="Login!" onClick="Login(this.form)" name="button">
</form> |
____________________________
Been busy trying to take a second degree <--it's not working out...
|
|
29-01-2003 at 05:47 AM |
|
|
|
|
 |
 |