index | search | no replies | posting guidelines | help login | register
Index » Products » ASP Report Wizard v2
search this forum:
:: Sample asp code ::    show all messagesPost a New Message | Post a Reply
Jul 19 2004, 6:26 AM
 Re: Sample asp codePost a Reply
 ghost

View this author's profile Send this author a private message Visit author's homepage

from: Washington, DC

I am not sure I've understood your question. But below is sample code for using the report wizard's DataGrid object to programmatically create master-detail reports

<%
  
  On  Error  Resume  Next
  
  Dim objGrid
  Set objGrid = Server.CreateObject("AspWebSolution.DataGrid")
  With objGrid
     .Command = "SELECT ProductName, UnitPrice, UnitsInStock, "& _
          "UnitsOnOrder,  Suppliers.CompanyName FROM Products,  Suppliers "& _
          "WHERE Products.SupplierID=Suppliers.SupplierID"
      
     'set your master table
     .MasterTable= "Suppliers"
      
     'add some style
     .GridStyle= "background-color:gray;"
     .HeaderStyle= "background-color:#666699;"
     .HeaderTextStyle = "color:#ffffff;font-family:verdana;font-size:8pt;"
     .ItemStyle = "background-color : #d2d1de;color:000000;font-family:verdana;font-size:8pt;"
     .AltItemStyle = "background-color:#f5f5f5; color:000000;font-family:verdana;font-size:8pt;"
     .FooterStyle= "font-family:verdana;font-size:8pt;"
  End  With  
  
objGrid.CreateConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb;")
  
  Call objGrid.ColumnCaption("ProductName","Product Name")
  Call objGrid.ColumnCaption("UnitPrice","Price")
  Call objGrid.ColumnCaption("UnitsInStock","In Stock")
  Call objGrid.ColumnCaption("UnitsOnOrder","On Order")
  Call objGrid.ColumnCaption("CompanyName","Supplier Name")
  
  Call objGrid.CurrencyColumn("UnitPrice", 2)
  Call objGrid.BoolColumn("Discontinued","Yes","No" )
  
  Call objGrid.LinkColumn("ProductName",  _  
     "http://google.icq.com/search/results/?q=#TEMP#",  _
     "#TEMP#","_blank")
      
objGrid.Display
  Set objGrid =  Nothing
  
  If Err.number<>0  Then
     Response.Write "<font color=red>Error #: "& Err.number & "<br>"& Err.Description & "<br>Source: "& Err.Source & "</font>"
  End  If
%>





-------------------------
Ghost
Pages: (1)   [1]

search this forum: