kjoter
October 12th, 2001, 05:08 AM
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")
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")