Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    1

    Red face Unanswered: Distance Calculation Expression "where in" problem

    I am getting this error:

    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC Microsoft Access Driver] Type mismatch in expression.

    In reference to this code ( the error is in the sql expression of rsZIPFINDER ):

    <%@LANGUAGE="VBSCRIPT"%>
    <% option explicit %>
    <!--#include file="../Connections/CampusWelfare.asp" -->
    <%
    Dim iSEARCHBY
    iSEARCHBY = Request.Form("searchby")
    iSEARCHBY = Replace(iSEARCHBY, "'", "''")

    Dim rsZIPCOORDS
    set rsZIPCOORDS = Server.CreateObject("ADODB.Recordset")
    rsZIPCOORDS.ActiveConnection = MM_CampusWelfare_STRING
    rsZIPCOORDS.Source = "SELECT LAT, LNG FROM ZIPDATA WHERE ZIP_CODE = '" & iSEARCHBY & "'"
    rsZIPCOORDS.CursorType = 0
    rsZIPCOORDS.CursorLocation = 2
    rsZIPCOORDS.LockType = 3
    rsZIPCOORDS.Open()
    rsZIPCOORDS_numRows = 0

    Dim iLAT, iLNG, iRADIUS
    iLAT = rsZIPCOORDS("LAT")
    iLAT = Replace(iLAT, "'", "''")
    iLNG = rsZIPCOORDS("LNG")
    iLNG = Replace(iLNG, "'", "''")
    iRADIUS = Request.Form("distance")
    iRADIUS = Replace(iRADIUS, "'", "''")

    Dim rsZIPFINDER
    set rsZIPFINDER = Server.CreateObject("ADODB.Recordset")
    rsZIPFINDER.ActiveConnection = MM_CampusWelfare_STRING
    rsZIPFINDER.Source = "SELECT SCHOOL_ID, S_NAME, S_CITY, S_STATE, S_URL FROM SCHOOLS WHERE S_ZIP IN ( SELECT ZIP_CODE FROM ZIPDATA WHERE " & iRADIUS & " > SQR(((69.1 * (LAT - " & iLAT & ")) ^ 2) + ((69.1 * (LNG - " & iLNG & ") * COS(" & iLAT & " / 57.3)) ^ 2)))"
    rsZIPFINDER.CursorType = 0
    rsZIPFINDER.CursorLocation = 2
    rsZIPFINDER.LockType = 3
    rsZIPFINDER.Open()
    rsZIPFINDER_numRows = 0

    %>

  2. #2
    Join Date
    Feb 2003
    Location
    Los Angeles
    Posts
    18

    Arrow

    Hey,

    I didn't find in your code where you set the connection
    and the connection string -

    Set conn = server.CreateObject("ADODB.connection")
    conn.Open "PROVIDER=DBDriver(SQL/Access/Oracle);DATA SOURCE=DBLocation;UID=UserName;PWD=UserPassword;DA TABASE=DBName"
    Eddie.

Posting Permissions

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