access Oracle db

Jade
04-14-2003, 07:03 AM
Hello, I am writing an application in VB 6.0.
I have to plot information from an Oracle database on a map.
I' ve read that it is possible to do this with an udl-file, like this:


zDataSource = "\\mozart\vab\stagairs\VB\connectie.udl"
Set pechgevalDataSet = mainMap.DataSets.ImportData(zDataSource, , geoCountryBelgium)


I would like to know whether it is possible to access only one view.
And if this is possible.. I also would like to know if it is possible to run SQL-statement from my VB-application.

Would you be so kind to help me with a code-example. Any comments are more than welcome..

Regards,

Jade

wgm01
04-22-2003, 01:24 PM
I use VB6.0 to access an Oracle DB for mapping purposes, I cannot help you with the udl file, but I can show you an example of my code.

I regularly use the datadesiger/connect objects to open a recordset. An example of my code is below (to use this code you must add and define your oracle database connection using a data designer named DataEnvironment1).

Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim objFindResults As MapPointCtl.FindResults
Dim objPushpin As MapPointCtl.Pushpin
Dim objMap As MapPointCtl.Map

Set objMap = mapform.themap.ActiveMap

'##### Open data connection to Oracle #####

Set cnn = DataEnvironment1.Connection1

If cnn.State = adStateClosed Then
cnn.Open
End If

'##### Check if record currently exists in DB #####

Set rs = New ADODB.Recordset

rs.Source = "select * from main"
Set rs.ActiveConnection = cnn
rs.Open

rs.MoveFirst
Do Until rs.EOF

Set objFindResults = objMap.FindAddressResults(rs!Address, _
rs!City, , rs!State, rs!zipcode, geoCountryUnitedStates)

If objFindResults.ResultsQuality = geoFirstResultGood Then
Set objLoc = objFindResults.Item(1)
end if

Set objPushpin = objMap.AddPushpin(objLoc, _
rs!Retailer_number & " " & _
rs!Business_name)

loop

rs.Close
cnn.Close

Set cnn = Nothing
Set rs = Nothing

Jade
04-23-2003, 02:10 AM
great!! just what I need!

thank you very much!

one question:

"Set objFindResults = objMap.FindAddressResults(rs!Address, _ rs!City, , rs!State, rs!zipcode, geoCountryUnitedStates)"

rs!Address : I suppose this is the column name of your tables?

Jade
04-25-2003, 02:13 AM
I tried the code, and it works, it only takes about 10 minutes to load 48 records..

 
Web mp2kmag.com
mapforums.com