Phil:  You said:  "I'm pretty new to MapXSite and the rest of the MapInfo
products.  And I
can't seem to find an explicit example of an ODBC link either in ASP or
otherwise.
Where can I look?"

I found that answer and lots of other good stuff in:

"Beginning Active Server Pages 2.0"
Francis, Kauffman, Llibre, Suusman and Ullman
Wrox Press Ltd, June 1998    $US 39.99

and they have a neat web site too :

 http://www.wrox.com

In ASP jargon you use the ActiveX Data Object (ADO) in your VB Script
program to set up ODBC connections and execute ODBC queries.  Following are
some code fragments of an ASP 2/ MapX 3.5/ Sql Server 6.5 app that I
developed recently.  The code builds a MapX thematic map with two-colored
pies indicating the capacity and current content of grain silos, with these
parameters coming from a corporate SqlServer database via ADO.

Briefly, the code instantiates MapX and ADODB.Connection as "session"
objects.  The SqlServer database has an ODBC DSN of "binboards".  I used the
new MapX "Safe Array" dataset type to set up the Pie Chart Theme .  The
dataset is bound to a MapX map layer called "Site3" on column
"Site3.StationID".

Good luck with your app.

Regards

David M Haycraft                   Phone/Fax:  61 + 2 + 6231 8104
Information Analysis Assocs  P/L   Mobile:     0412 001 134
ACN 085 516 105                    Email:
[EMAIL PROTECTED]
1 Cumming Place, Wanniassa         Web:
www.acslink.aone.net.au/actaa/iaa.htm
A.C.T. 2903, Australia             A MapInfo Partner


GLOBAL.ASA
----------------------
const ClassMapXMap="MapX.Map.3"
const ClassADODBConn="ADODB.Connection"
const ClassADODBRS="ADODB.Recordset"

' Mapx object
set objMap1=Server.CreateObject(ClassMapXMap)
objMap1.Geoset=strGeoset
objMap1.Title.Visible=false
objMap1.PaperUnit=miPaperUnitCentimeter
objMap1.MapUnit=miUnitKilometer
set Session("objMap")=objMap1

'Connection objects
set objConBinboards=Server.CreateObject(ClassADODBConn)
objConBinboards.Open "DSN=binboards","",""
set Session("objConBinboards")=objConBinboards
REGNMAP.ASP
------------------------
Sub AddStockFreeTheme()

' display site map with stock/free theme
Dim strSql
Dim objDataSet 'Dataset
Dim objTheme 'Theme
Dim objFields 'Fields
Dim intColor
Dim i
Dim n
Dim arrTemp() ' n x 3

' build ADO query for "binboards"
strSql = "SELECT SiteCapacity.BINSTN as BINSTN, SumOfPBSAS as COMMODITY,
SumOfBINCAP-SumOfPBSAS AS FREE " _
+ " FROM SiteCapacity " _
+ " LEFT JOIN SiteContent ON SiteCapacity.BINSTN = SiteContent.PBSSTN;"
objRs.Open strSql, objConBinboards, adOpenStatic , adLockReadOnly
n=objRS.RecordCount
if n<1 then
objRS.Close
exit sub
end if

' retrieve result set and store in array
Redim ArrTemp(n,2)
i=-1
objRs.MoveFirst
while Not objRs.EOf
i=i+1
ArrTemp(i,0)= objRs.Fields("BINSTN")
ArrTemp(i,1)= objRs.Fields("COMMODITY")
ArrTemp(i,2)= objRs.Fields("FREE")
objrs.MoveNext
wend
objRS.Close

' join Array to Map table to create dataset
' using ArrTemp.Column1= [Site3].STATIONID
objMap1.Datasets.RemoveAll
Set objDataSet =objMap1.Datasets.Add(miDatasetSafeArray, ArrTemp,
"DS",1,,"Site3")
' use 2nd thru 3rd dataset column for theme
set objFields=Server.CreateObject(ClassMapXFields)
For i = 2 To 3
objFields.Add i,i, miAggregationSum, miTypeNumeric
Next
Set objTheme = objDataSet.Themes.Add(miThemePieChart, objFields, "Spare by
Site")
' set pie style
objTheme.ThemeProperties.Size = 1 ' paperUnit=cm
objTheme.ThemeProperties.DataValue = StockFreePieScale ' value for 1 cm pie
objTheme.ThemeProperties.MultivarCategories(1).Style.RegionColor = COccupied
objTheme.ThemeProperties.MultivarCategories(2).Style.RegionColor = CFree

' set legend style
objTheme.Legend.Visible = False
set objFields=Nothing
End Sub

----------------------------------------


----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to