Register  |  Login   Search
ThinkGeo - GPS Tracking and Mapping Solutions  |  Home  |  Cygnus Track  |  Developer Community
 
LivePerson Chat

Discussion Forums

The online community for users of Map Suite GIS components

map1.Layers["..."].SQLQuery support
Last Post 10-29-2008 02:41 AM by Scott. 3 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
DamianUser is Offline
Level 1
Level 1
Posts:2

--
10-22-2008 08:56 PM

The ".SQLQuery" method is available in the MapSuite web tools, however this method isn't available in the PocketPC version.

Is there a simular way to achieve the result on using PocketPC?

Is there plans to impliment this method into the PocketPC version?

i am currently working with version 2.20 of the map suite dll's.

Thankyou

ScottUser is Online
MVP
MVP
Posts:54
Avatar

--
10-23-2008 10:08 PM
Damian,

At this time the PocketPC can't support the SQLQuery function, the reason is that the compact framework can't support the System.Data.OleDb namespace. I think there is another function is similar to the SQLQuery function, it is DataQuery function. It has 4 overloads methods, you can select one to use as your requirments, the following are the DataQuery methods:

1, Public Function DataQuery(ByVal RecordNumbers() As Integer, ByVal FieldNames() As String) As Array
2, Public Function DataQuery(ByVal RecordNumber As Integer, ByVal FieldName As String) As String
3, Public Function DataQuery(ByVal RecordNumbers() As Integer, ByVal IncludeShape As Boolean) As DataTable
4, Public Function DataQuery(ByVal RecordNumber As Integer, ByVal IncludeShape As Boolean) As DataTable

Thanks,
DamianUser is Offline
Level 1
Level 1
Posts:2

--
10-29-2008 12:02 AM
Fantastic! Not exactly the most usable function but does the job... To save the pain of figuring out what I had too, here is the cheat sheet :

// Grab the number of records available in the layer (in my case 14 thousand!)
var LayerRowCount = map1.Layers[2].RecordCount;

// Build an array containing those numbers
int[] myArrayInt = new int[LayerRowCount];
for (var count = 0; count < LayerRowCount; count++)
{
myArrayInt[count] = count+1;
}

// Create an array of strings for the column names I want
var mySt = new string[4];
mySt[0] = "recid";
mySt[1] = "ADDR_MATCH";
mySt[2] = "HOUSE_LOW";
mySt[3] = "ROAD_NAME";

// Create an array
var myDT = map1.Layers[2].DataQuery(myArrayInt, mySt);

// C# has a bit of a hard time understanding the structure of the array, so this is how you use it
var arrayRoadName = ((System.String[])myDT.GetValue(arrayRow))[3].ToString();
ScottUser is Online
MVP
MVP
Posts:54
Avatar

--
10-29-2008 02:41 AM
Damian,

I have tested your code, if you want to get the value of Road_Name field, you can do a loop through all records, then put them into a array, please see the following code:

// C# has a bit of a hard time understanding the structure of the array, so this is how you use it
string[] roadsName = new string[myDT.Length];
for (int i = 0; i < myDT.Length; i++)
{
roadsName = ((System.String[])myDT.GetValue(i))[3].ToString();
}

You are not authorized to post a reply.

Active Forums 4.1