<%@Language=VBScript%> <% Response.Expires = 0 Response.Buffer = TRUE %> Milestones Professional ASP/Access Example Milestones Professional ASP/Access Example

This example shows the creation of a schedule from an Access Database.

<% 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 "" Response.Write "Processing..." Response.Write "" adCmdText = 1 set oConn=Server.CreateObject("ADODB.connection") vCS = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=http://www.kidasa.com\information\programmers\asp\aspdemos\accesssample.mdb" oConn.connectionstring = vCS oConn.Open set oRS=server.createobject("ADODB.recordset") strCommand = "Select * from ScheduleInfo" 'Response.write strCommand oRS.open strCommand, oConn if(oRS.EOF) then Response.Write "

" Response.Write ">Table ScheduleInfo is empty." Response.Write "" bOkayToContinue = FALSE oConn.Close 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") oMiles.Activate oMiles.Refresh oRS.movefirst 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=" " Else szTaskName=CStr(TaskName) End If If (IsNull(OutlineLevel)) Then OutlineLevel=1 End If If (OutlineLevel<1) Then OutlineLevel=1 End If If (OutlineLevel>9) Then OutlineLevel=1 End If If (IsNull(Resp)) Then szResp=" " Else szResp=CStr(Resp) End If If IsDate(StartDate) Then szStartDate=CStr(StartDate) Else szStartDate=" " End If If IsDate(EndDate) Then szEndDate=CStr(EndDate) Else szEndDate=" " End If Response.Write "

" Response.Write "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 ")" 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 oRS.movenext Wend 'Create and display jpeg of schedule Randomize ImageName = "filtout"+CStr(Rnd)+".jpg" FullPathImageName = "http://www.kidasa.com\information\programmers\asp\images\"+ImageName WWWPathImageName="/information/programmers/asp/images/"+ImageName oMiles.SaveBitmap (FullPathImageName) oMiles.Close "NoSave" Response.Write "

" ' Close database connection oConn.Close Set oConn = Nothing End If %>