CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: VB -scripts..

  1. #1
    Join Date
    Jul 2000
    Posts
    67

    VB -scripts..

    Hello, and thank you for good help earlier!

    This is a very basic question. I have the code for a VB script, but i dont know how to use it. Shall i compile it in VisualBasic, or shall i just save it as *.vbs and run it from the server? Shall i make an *.exe file of it? This is not for use on the web together with asp, but for use to do a post address search in a database.
    I have pasted in the script below if anyone are interested.

    Grateful for all answers.

    Option Explicit

    Dim myPaf
    Dim myCResp

    'On Error Resume Next

    Set myPaf = wscript.createobject("nbPafSearchR.nbPafSearchR) 'for VB Script requests
    'set m_paf = server.CreateObject("nbPAFSearchR.PAFSearchR") ' for ASP based requests
    'now it is time to populate the request
    Set myCResp = m_Paf.DoPafSearch("FullPostCode", _
    "BuildingNumOrName", _
    "OrganisationName", _
    "ThoroughfareName", _
    "PostalTownName", _
    "CountyName", _
    "", _
    "MinSearchQuality", _
    1, _
    "MaxDisplay", _
    0)
    'now check the results......Error check first
    If Err.Number <> 0 Then
    'inform the user/caller that there is an error getting the PAF data for this requestprovided.</b>
    ")
    'Displaying err.description would be a good idea here
    Err.Clear
    Else
    'lets us check the for the number of results in our collection
    Select Case myCResp.recordcount
    Case 0 'nothing to display...sorry..tell the user
    Case 1 ' an exact match has been located.
    Case Else ' more than o..need to show the user so that a sensible selection can be done
    End Select
    End If

    'release the objects..now that i am done.....
    Set myPaf = Nothing
    Set myCResp = Nothing

    'field names returned in the recordset from this call (cMyResp) - for each entry row in the ADO recordset.
    myCResp ("RawPAFData")
    myCResp ("OrganisationName")
    myCResp ("POBoxNo")
    myCResp ("SubBuildingName")
    myCResp ("BuildingName")
    myCResp ("BuildingNo")
    myCResp ("SubThoroughfareName")
    myCResp ("ThoroughfareName")
    myCResp ("SubLocalityName")
    myCResp ("LocalityName")
    myCResp ("PostalTownName")
    myCResp ("CountyName")
    myCResp ("DeliveryPointSuffix")
    myCResp ("InwardPostCode")
    myCResp ("OutwardPostCode")
    myCResp ("FullPostCode")

    'DoPafSearch Signature (including defaults etc)
    Public Function DoPafSearch( _
    ByVal FullPostCode As String, _
    ByVal BuildingNumOrName As String, _
    Optional ByVal OrganisationName As String = "", _
    Optional ByVal ThoroughfareName As String = "", _
    Optional ByVal PostalTownName As String = "", _
    Optional ByVal CountyName As String = "", _
    Optional ByVal IndividualFamilyName As String = "", _
    Optional ByVal MinSearchQuality As Long = 80, _
    Optional ByVal UsePAFTags As Boolean = True, _
    Optional ByVal MaxDisplay As Long = 50, _
    Optional ByVal OccupantNamesReturnInd As Boolean = False _
    ) As ADOR.Recordset

    'notes:
    'If you have the post code and house number, this is the minimum requirement for doing a PAF search. All other parameters have default values assigned at runtime. You can however pass them through if required.
    Set myCResp = m_Paf.DoPafSearch("FullPostCode", "BuildingNumOrName")






  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: VB -scripts..

    If it doesn't "need" to be in VBScript, I'd go for VB. VB is much faster than VBScript, excpecially when you are using a lot of objects like a recordset and stuff. Of course, when you need to change it, you will need to recompile it.

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured