|
I am trying to create a ODBC dataset
based on a normal SQL query and bind the resultant data to my base map layer
"Tl" My primary geocolumn is "Loc_code". Iam using this
code . The problems are function od_bc() as boolean ��
on error goto errhandler ��
dim brc as boolean ��
dim objODBCQueryInfo as object ��
dim objFields as object ��
dim objds,fld,f as object ��
dim objBindLayer,objtheme as object � ������������� ��������������� bRC
= CreateMapODBCQueryInfo(objODBCQueryInfo) ��������������� objODBCQueryInfo.SqlQuery
= g_sql��������� ��������������� ///////��������������� g_sql="select * from vill
where t_popln>variable" ��������������� objODBCQueryInfo.DataSource
= "wbt"���� ��������������� ' name of odbc datasource ��������������� objODBCQueryInfo.ConnectString
= "ODBC;dlg=0" ��������������� dim
l1,nrow as integer ��������������� dim
beods as boolean ��������������� ��������������� set
objBindLayer = g_objMapX.layers("tl") ��������������� g_objMapX.datasets.add
miDataSetODBC, objODBCQueryInfo, "dsODBC","loc_code" , ,
objBindLayer ��������������� ��������������� set
objDS = g_objMapX.DataSets("dsODBC") ��������������� set
objTheme = objds.themes.add (6,"district") ��������������� print
objds.recordcount ��������������� ///
This prints 9999 but my recordsethave less than 9999 rows and total number of
rows in layer ����� "TL" is
9999. Can i get only that number of rows in a dataset which is present in the
odbc recordset ��������������� l1=1 ��������������� for
each fld in objDS.fields ��������������� ��������������� g_strOutputMessage=g_strOutputMessage
& "<FONT COLOR=""#0000ff"">" & _ ��������������� ��������������� fld.name &
"</font>: " & objDS.value(l1,fld) &
"<br>" ��������������� ��������������� l1=l1+1�� ��������������� ��������������� /// LOOP 1 ��������������� next ��������������� ��������������� ��
������������ bEODS = false ��
������������ nRow = 1 ��
������������ while not bEODS ��������������� ��������������� for each f in� objDS.fields ��������������� ��������������� LOOP 2 ��������������� ��������������� ��������������� if
objds.value(nrow,f)<>"" then ��������������� ��������������� ��������������� ��������������� print� objDS.value(nRow,f) & "<br>" ��������������� ��������������� ��������������� end
if ��������������� ��������������� next ��������������� END_OF_DATA: ��������������� � ������������� ��������������� nRow = nRow + 1 ��������������� ��������������� ��������������� if
nrow=175 then ��������������� ��������������� ��������������� ��������������� exit function ��������������� ��������������� ��������������� end
if ��������������� wend����� ��������������� � Exit Function ErrHandler: ��������������� 'Error
1049 tells us we've reached the end of the dataset. ��������������� If
Err.Number = 1049 Then ���
����������� bEODS = True ���
����������� Resume END_OF_DATA ��������������� end
if ��������������� end function 1.��
LOOP 1 prints nothing but the field names of my Access Table Why? Is the
binding OK ? 2.��
LOOP 2 prints only a few values though all the loc_codes present in the
recordsource are also present in the "TL" Mapinfo table how can i get
the rest ? 3.��
From problem 2 the theme displays all districts in various colors which
should mean that databinding with map layer is OK but why the associated data
is not coming in the two loops ? 4.��
Suppose i get the data properly now how can i show those villages(by the
odbc query) on the map in different colors and symbols? Can those villages be
put into a new temp layer with the corresponding attributes(loc_code and name)
of the base "TL " layer so that i can requery that temp layer ? 5.�
From a dataset bound to a layer can i pick objects based on the map and
and put in other layers. If possible some sample code 6.�
I am not that comfortable with the selection object. Is it similar to
the selection layer/table as in MapInfo ? If not how can i use that to select some
map objects based on some criteria(either map query or Access database
Query)� ����
7. In LOOP 2 i have to restrict the
number of records to 175 or some smaller values. With my actual recordset(about
900) the server timeout message appears. How to check for that ? |
