Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2004, 12:44 AM
Authorized User
 
Join Date: May 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default


so i tried that code

<%@Language="VBScript"%>
<%
    Option Explicit

    Dim oRS, oConn, strSQL
    Dim i
    Dim results


    Set oConn = Server.CreateObject("ADODB.Connection")
    Set oRS = Server.CreateObject("ADODB.Recordset")

    oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("AddressBook.mdb")

strVar=Request.QueryString("var")

If strVar="all" Then strSQL="select ContactID, Movie, Result ORDER BY Result, Movie asc"

If strVar="film" Then strSQL="select ContactID, Movie, Result WHERE Result = 'film' ORDER BY Movie asc"

If strVar="tv" Then strSQL="select ContactID, Movie, Result WHERE Result = 'tv' ORDER BY Movie asc"

If strVar="portrait" Then strSQL="select ContactID, Movie, Result WHERE Result = 'portrait' ORDER BY Movie asc"


    oRS.Open strSQL, oConn, 2, 3

    If oRS.EOF Then
        Response.Write "success=False"
    Else
        Do While Not oRS.EOF
            results = results & oRS("Movie") & " " & oRS("Result") & ";"
        oRS.MoveNext
        Loop
        results = results & "q"
        Response.Write "success=True&results="

    End If

    oRS.Close
    Set oRS = Nothing
    oConn.Close
    Set oConn = Nothing
    Response.Write Server.URLEncode(results)
%>

i get this error
Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'strVar'

/pk/first2.asp, line 15

 
Old May 19th, 2004, 01:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

It has to be defined.

Dim strVar

Put this below "Option Explicit"

Cheers!

-Vijay G
 
Old May 19th, 2004, 01:53 AM
Authorized User
 
Join Date: May 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

now its giving me
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Result WHERE Result = 'film' ORDER BY Movie asc'.

/pk/first2.asp, line 27


 
Old May 19th, 2004, 01:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

So now you are out of the SYNTAX error and BACK to the same old ERROR which U.N.C.L.E. and bmains were mentioning in the earlier mails.

Where is the FROM clause?

Select [COLUMN_LIST,....]
FROM <TABLENAME>
WHERE <CRITERIA>

Please refer the syntax for SELECT statement.


-Vijay G
 
Old May 21st, 2004, 12:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Have you sorted this out? Pls update.

-Vijay G
 
Old May 21st, 2004, 10:56 AM
Authorized User
 
Join Date: May 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

got it thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
Parser Error w/ REALLY Basic CSS martini_shark CSS Cascading Style Sheets 3 November 25th, 2006 02:39 AM
Visual Basic 6.0 - Application Error miqbal Pro VB 6 8 September 2nd, 2006 01:54 AM
Basic concepts with asp.net cool_hari BOOK: Beginning ASP.NET 1.0 1 August 28th, 2006 03:41 AM
Visual basic run time error. rushikesh_mistry Access VBA 2 October 22nd, 2004 07:05 AM
basic error on Polymorphism samchan BOOK: Beginning Java 2 7 December 8th, 2003 06:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.