Milestones Professional ASP Example #2

This example shows the creation of a schedule from an Access Database and present a bitmap to the browser user.

You can try this example (even if you aren't a programmer).  Click here to visit our Automation Demo page.

When initialized within a browser, this demo:
1     Creates a Database connection for ActiveX Data Objects to an existing Microsoft Access table.
2 Creates a new Milestones Professional schedule object.
3 Used the information in the Access table to create tasks on the schedule.
4 Generates a bitmap and displays the bitmap in the user's browser.
Note: this is a very simple example. You might have a form which prompts the user to select a schedule to display.  We'll have some more advanced examples soon.  Check back to this page.  Meanwhile, click here to visit our main programmer's page and check out our examples for Excel, Access and Microsoft Project.  Click here if you would like to try this example on our server.

About using Milestones with ASP Scripts on your WebServer

Run one of our examples on our server

ASP CODE    (Milestones interface calls shown in Blue)
<% Response.Expires = 0
Response.Buffer = TRUE

<head><b><font face="Verdana" size="4">Milestones Professional ASP/Access Example</b></font>
<title>Milestones Professional ASP/Access Example</title>

<body bgcolor="#FFFFFF">

<p><font face="Verdana" size="2">This example shows the creation of a schedule from an Access Database.</font>


Dim TaskName
Dim Resp
Dim StartDate
Dim EndDate
Dim OutlineLevel

Dim szTaskName
Dim szResp
Dim szStartDate
Dim szEndDate

Dim RowNumber

bOkayToContinue = TRUE

if (bOkayToContinue) Then

  Dim oConn
  Dim oRS
  Dim vCS

  Dim adCmdText
  Dim strSqlUpdate

  Response.Write "<tr>"
  Response.Write "<td><font face=""Verdana"" size=""2"">Processing...</font></td>"
  Response.Write "</tr>"

  adCmdText = 1

  set oConn=Server.CreateObject("ADODB.connection")
  vCS = "Provider=Microsoft.Jet.OLEDB.4.0; 

  Data Source=\information\programmers\asp\aspdemos\accesssample.mdb"
  oConn.connectionstring = vCS
  set oRS=server.createobject("ADODB.recordset")
  strCommand = "Select * from ScheduleInfo"

'Response.write strCommand strCommand, oConn

  if(oRS.EOF) then
    Response.Write "<p>"
    Response.Write "><font face=""Verdana"" size=""2"">Table ScheduleInfo is empty.</font>"
    Response.Write "</9>"
    bOkayToContinue = FALSE
    Set oConn = Nothing
  End If

End If

RowNumber = 0

if (bOkayToContinue) Then

'Get ml6 starter file for access sample
set oMiles = GetObject("c:\miles2000\accesssample.ml6")



While Not oRS.EOF
  RowNumber = RowNumber+1

  TaskName = oRS("TaskName")
  Resp = oRS("Resp")
  StartDate = oRS("StartDate")
  EndDate = oRS("EndDate")
  OutlineLevel = oRS("OutlineLevel")

  If (IsNull(TaskName)) Then
    szTaskName=" "
  End If

  If (IsNull(OutlineLevel)) Then
  End If

  If (OutlineLevel<1) Then
  End If

  If (OutlineLevel>9) Then
  End If

  If (IsNull(Resp)) Then
    szResp=" "
  End If

  If IsDate(StartDate) Then
    szStartDate=" "
  End If

  If IsDate(EndDate) Then
    szEndDate=" "
  End If

  Response.Write "<p>"
  Response.Write "<font face=""Verdana"" size=""2"">Access Table Row "+CStr(RowNumber)

  Response.Write ": TaskName(" + szTaskName
  Response.Write "), Resp(" + szResp
  Response.Write "), StartDate(" + szStartDate
  Response.Write "), EndDate(" + szEndDate
  Response.Write "), OutlineLevel(" + CStr(OutlineLevel)
  Response.Write ")</font>"

  oMiles.PutCell RowNumber, 2, szTaskName
  oMiles.PutCell RowNumber, 1, szResp
  oMiles.SetOutlineLevel RowNumber, OutlineLevel
  If (IsDate(StartDate)) Then
    oMiles.AddSymbol RowNumber, szStartDate, 1, 1, 2
  End If

  If (IsDate(EndDate)) Then
    oMiles.AddSymbol RowNumber, szEndDate, 2
  End If



'Create and display jpeg of schedule


ImageName = "filtout"+CStr(Rnd)+".jpg"

FullPathImageName = "\information\programmers\asp\images\"+ImageName


oMiles.SaveBitmap (FullPathImageName)

oMiles.Close "NoSave"

Response.Write "<p><img src="""+WWWPathImageName+"""></p>"

' Close database connection


Set oConn = Nothing

End If




The Scheduleinfo table:

Task Name Resp StartDate EndDate OutlineLevel
"Software Product ""X""" 1     1
GUI DE 3/5/2001 8/15/2001 2
Print KG  4/18/2001  9/20/2001 2
Marketing            1
Print Ads CW 7/25/2001 12/31/2001 2
Banner Ads CW 8/10/2001 11/30/2001 2

Click here to visit our main programmer's page.