Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Airickjay

@Airickjay
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Multiple queries within an ADO connection
    A Airickjay

    Thanks for the quick responses, I've made some real progress and have gotten the queries to work!

    Database database help data-structures tutorial

  • Multiple queries within an ADO connection
    A Airickjay

    First off, I really don't know much about vbScript, so hopefully what I have thrown together won't look too awful. I am trying to come up with a way to label parcels in ArcGIS, and I am about ready to throw my computer out the window. I have to use vbScript to create the labels by connecting to a database pulling the data from multiple tables, assembling a text string and assigning it to a polygon. Unfortunately the vbScript engine in ArcGIS doesn't support joins, so I came up with a way to create one query, get the data I need from one table and stuff it into an array (if necessary) for the second query. Unfortunately, I am getting bombarded with errors when I try to do the second query, and I have scoured search engines for a solution with no luck at all. Everything I found tells me how to do one query, but doesn't address the problem of running multiple queries. Any help that I can be given would be greatly appreciated. Everything works fine until I try to do the second query. I'm not sure what the procedure is to do another query, or if it's even possible. Here is what I have written so far, including the portions that don't work (they are commented out). Thanks a lot in advance!

    Function FindLabel ([FEATURE_ID])

    Dim strPrclQry, strLseQry, strinfo, LeaseNum, aLeaseList, LabelCount, FinalLabel, sLeaseList

    'form query string
    strPrclQry = "SELECT LEASE_NAME FROM TRACTS WHERE TRACTS.FEATURE_ID = '"&[FEATURE_ID]&"' ORDER BY LEASE_NAME ASC"

    Dim ADOConn
    set ADOConn = CreateObject("ADODB.Connection")
    Dim rsPrcl
    set rsPrcl = CreateObject("ADODB.Recordset")

    ADOConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=.\DART_PROJECTS.mdb"

    ADOConn.CursorLocation = 3

    rsPrcl.Open strPrclQry, ADOConn, 3, 1, 1

    'if no record is found, return empty string

    Select Case rsPrcl.RecordCount
    Case -1, 0
    strInfo = " "
    Case 1
    'reading only the first record

      LeaseNum = rsPrcl.Fields("LEASE\_NAME").Value
      strInfo =  LeaseNum + strInfo  
      aLeaseList = strInfo    
    

    Case Else

      for I = 1 to rsPrcl.RecordCount
            if I <> 1 then
               strInfo = " " + strInfo
            End If
    
            LeaseNum = rsPrcl.Fields("LEASE\_NAME").Value
            strInfo = LeaseNum + strInfo
            rsPrcl.Movenext
      Next
    
      aLeaseList = Split(strInfo)
    

    End Select

    'closing connections

    rsPrcl.Close
    Set rsPrcl = Nothing

    'put arrays into labels

    If IsArray(aLeaseList) <> 0 then

    LabelCount

    Database database help data-structures tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups