PDA

View Full Version : ImportData



lacja
11-16-2006, 11:06 AM
I'm trying to importdata from an Access Table.

It works fine if I import every records.

But, before importing data, user has to enter few parameters (date, time, ...)

I'd like to import only records that fits in user's parameters

I've tried with a select in the database, put records into a text file and then importdata with geoDelimiterSemicolon (Set oDS = objMap.DataSets.ImportData(myfilename, , geoCountryCanada, geoDelimiterSemicolon, 1)).

My oDS dataset is always empty.

What's wrong?

Thanks

Mattys Consulting
11-16-2006, 08:02 PM
Lacja,

Did you solve this problem or are you still seeking help?
Are you sure you're exporting using semicolon and not comma?
Can you post a few lines of the text file?

lacja
11-16-2006, 09:01 PM
Here it is:

47,6443507242948000 ; -70,1569795701653000
46,8069542571902000 ; -71,2153752241284000
46,8412129394710000 ; -71,2770252116024000
46,8361057620496000 ; -71,2258935067803000
48,5575715638697000 ; -71,6472415532917000
46,8123630993068000 ; -71,2303665094078000
48,4017124213278000 ; -71,1607911810279000

Mattys Consulting
11-16-2006, 09:22 PM
OK. You need an array in the last parameter that indicates
that the first field is geoFieldLatitude and the second geoFieldLongitude.
You need only look up those words for an example.

lacja
11-17-2006, 12:33 PM
Hi,

I've alreayd tried:

Dim myfilename As String
Dim myExampleArray(2, 2)

myExampleArray(1, 1) = "Lat"
myExampleArray(1, 2) = geoFieldLatitude
myExampleArray(2, 1) = "Lon"
myExampleArray(2, 2) = geoFieldLongitude

myfilename = "c:\impdata.txt"
...
Set oDS = objMap.DataSets.ImportData(myfilename, myExampleArray, geoCountryCanada, geoDelimiterSemicolon, 1)

oDS always return "nothing"

Mattys Consulting
11-18-2006, 06:29 PM
You'd have to make some concessions, but this works for me :)

Public Function ImportText()
Dim myfilename As String
Dim myExampleArray(1, 1)

myExampleArray(0, 0) = "Latitude"
myExampleArray(0, 1) = geoFieldLatitude
myExampleArray(1, 0) = "Longitude"
myExampleArray(1, 1) = geoFieldLongitude

myfilename = "C:\import.txt"
oMap.DataSets.ImportData myfilename, myExampleArray, , geoDelimiterSemicolon, 0

End Function

Latitude;Longitude
47.6443507242948000 ; -70.1569795701653000
46.8069542571902000 ; -71.2153752241284000
46.8412129394710000 ; -71.2770252116024000
46.8361057620496000 ; -71.2258935067803000
48.5575715638697000 ; -71.6472415532917000
46.8123630993068000 ; -71.2303665094078000
48.4017124213278000 ; -71.1607911810279000

lacja
11-19-2006, 09:57 AM
Hey!

Now it works fine.

It was just my array definition?

Great

Thanks
:-D