Web Development

Our forums are currently in maintenance mode and the ability to post is disabled. We will be back up and running as soon as possible. Thanks for your patience!

General discussion

Locked

How to query a database from a web page?

By barry ·
Wanting to get some direction on how to build a web page that accesses an access database. Also, on this web page, I need to create a report with a time it takes to complete a certain tasks. This number (time) needs to exlude weekends. Can I use the"workday" feature for this.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

How to query a database from a web page?

by andrew In reply to How to query a database f ...

An easy way is to use ASP. Here's an entire ASP page that reads data from an Access DB and generates a web page:

<%@ Language=VBScript %>
<%Option Explicit%>
<HTML>
<HEAD>

<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY bgcolor=white>
<font face=Verdana>
<%
Dim sDSN
Dim oCon
Dim oRS

on error resume next
sDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:db1.mdb;"
Set oCon = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")

oCon.Open sDSN
oRS.Open "SELECT * FROM Table1", oCon
Do
Response.Write oRS.Fields("Name").Value & " " & oRS.Fields("Status").Value & "<br>"
oRS.MoveNext
Loop until oRS.EOF
%>

</font>
</BODY>
</HTML>

Here'sa link to more about ASP:
http://msdn.microsoft.com/asp

Collapse -

How to query a database from a web page?

by barry In reply to How to query a database f ...

The question was auto-closed by TechRepublic

Collapse -

How to query a database from a web page?

by andrew In reply to How to query a database f ...

In answer to your second question, you can use the DateDiff() function. The built-in weekday function doesn't work, so here's an algorithm that returns the weekday interval between 2 dates:

Function DateDiffW(BegDate, EndDate)
Const SUNDAY = 1
Const SATURDAY = 7
Dim NumWeeks As Integer

If BegDate > EndDate Then
DateDiffW = 0
Else
Select Case Weekday(BegDate)
Case SUNDAY: BegDate = DateAdd("d", 1, BegDate)
Case SATURDAY: BegDate = DateAdd("d", 2, BegDate)
End Select
Select Case Weekday(EndDate)
Case SUNDAY: EndDate = DateAdd("d", -2, EndDate)
Case SATURDAY: EndDate = DateAdd("d", -1, EndDate)
End Select
NumWeeks = DateDiff("ww", BegDate, EndDate)
DateDiffW = NumWeeks * 5 + Weekday(EndDate) - Weekday(BegDate)
End If
End Function

Collapse -

How to query a database from a web page?

by barry In reply to How to query a database f ...

The question was auto-closed by TechRepublic

Collapse -

How to query a database from a web page?

by barry In reply to How to query a database f ...

This question was auto closed due to inactivity

Related Discussions

Related Forums