■PostKit2: FindAddress Sample Program
       
      FindAddress1.asp
     
<html>
<head>
<title>PostKit2: FindAddress Sample Program</title>
</head>
<body>
<table align="center" width="400" border="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="center"><font size="3"><b>住所の取得の例</b></font></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
    </td>
      <!-- このフォームは郵便番号を次のページに渡す -->
      <form action="FindAddress2.asp" method="post">
         <table align="center" width="400" border="0" cellspacing="1" bgcolor="#000000">
          <tr>
            <td bgcolor="#ccccff">
              <table width="100%" border="0" align="center" bgcolor="#ccccff">
                <tr>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td align="center"> </td>
                </tr>
                <tr>
                  <td align="center">
                    <font size="2" color="#000099">郵便番号を入力してください。</font>
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td align="center">
                    <font size="2" color="#000099">郵便番号:
                      <input type="text" name="postalcode" size="10" value="<%=request("postalcode")%>">
                    </font>
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td align="center"><input type="submit" value="住所の取得"></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </form>
    </td>
  </tr>
</table>
</body>
</html>
       
      FindAddress2.asp
     
<html>
<head>
<title>PostKit2: FindAddress Sample Program</title>
</head>
<body>

<%
  Dim strPostalCode
  '前のページから郵便番号を取得する
  strPostalCode = Request.Form("postalcode")

  Dim Pk2
  Dim strPref,strCity,strTown,strNo,strOrgName
  Dim strPrefKana,strCityKana,strTownKana
  Dim i

  'PostKit2 のオブジェックトを作成する
  Set Pk2 = Server.CreateObject("PostKit2.PostKit")
  'PostKit2 の辞書をオープンする
  Pk2.OpenDic("C:\Dic")
  Pk2.FindMode=2
  Pk2.PostCode7=strPostalCode
  '全角カナ
  Pk2.KanaType=1
  '住所を検索(サブコードは含まない)
  Pk2.Find(false)

  If Pk2.FindCount <> 0 then
    For i=0 to Pk2.FindCount - 1
      Pk2.Read(i)
      '一般データの場合
      if Pk2.DataType = 0 then
        strPref=Pk2.PrefKanji
        strCity=Pk2.CityKanji
        strTown=Pk2.TownKanji

        strPrefKana=Pk2.PrefKana
        strCityKana=Pk2.CityKana
        strTownKana=Pk2.TownKana
      '大口事業所データの場合
      else
        strPref=Pk2.PrefKanji
        strCity=Pk2.CityKanji
        strTown=Pk2.TownKanji
        strNo=Pk2.No
        strOrgName=Pk2.OrgName

        strPrefKana=Pk2.PrefKana
        strCityKana=Pk2.CityKana
        strTownKana=Pk2.TownKana
      end if
    Next
  End If

  'PostKit2 の辞書をクローズする
  Pk2.CloseDic()

%>
<table align="center" width="400" border="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="center"><font size="3"><b>住所の取得の例</b></font></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>
      <table align="center" width="400" border="0" cellspacing="1" bgcolor="#000000">
        <tr>
          <td bgcolor="#ccccff">
            <table width="100%" border="0" align="center" bgcolor="#ccccff">
              <tr>
                <td align="center" colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td align="center" colspan="2">
                  <font size="2" color="#000099">検索結果の表示</font>
                </td>
              </tr>
              <tr>
                <td align="center" colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td align="right"><font size="2" color="#000099">郵便番号:</font></td>
                <td align="left">
                  <input type="text" name="postalcode" size="10" value="<%=request("postalcode")%>">
                </td>
              </tr>
              <tr>
                <td align="right"><font size="2" color="#000099">都道府県:</font></td>
                <td align="left"><font size="2">
                  <input type="text" name="strPref" size="30" value="<%Response.Write strPref%>"></font>
                  <font size="2" color="#006600"><%Response.Write strPrefKana%></font>
                </td>
              </tr>
              <tr>
                <td align="right"><font size="2" color="#000099">市区町村:</font></td>
                <td align="left"><font size="2">
                  <input type="text" name="strCity" size="30" value="<%Response.Write strCity%>"></font>
                  <font size="2" color="#006600"><%Response.Write strCityKana%></font>
                </td>
              </tr>
              <tr>
                <td align="right"><font size="2" color="#000099">町域:</font></td>
                <td align="left"><font size="2">
                  <input type="text" name="strTown" size="30" value="<%Response.Write strTown%>"></font>
                  <font size="2" color="#006600"><%Response.Write strTownKana%></font>
                </td>
              </tr>
              <tr>
                <td align="right"><font size="2" color="#000099">番地:</font></td>
                <td align="left"><font size="2">
                  <input type="text" name="strNo" size="30" value="<%Response.Write strNo%>"></font>
                </td>
              </tr>
              <tr>
                <td align="right"><font size="2" color="#000099">事業所:</font></td>
                <td align="left"><font size="2">
                  <input type="text" name="strOrg" size="30" value="<%Response.Write strOrgName%>"></font>
                </td>
              </tr>
              <tr>
                <td align="center" colspan="2">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
Copyright (C) NEWTONE Corporation. All rights reserved.