Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 July 3rd, 2005, 01:48 PM
Registered User
Join Date: Jul 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Thac
Default System.Data.OleDb.OleDbException: Expected query n

Could someone please help me. I'm trying to access the data in a query in an Access 97 Database from my ASP.net page. I'm using Visual Studio.net and I keep getting the error:

Expected query name after EXECUTE.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Expected query name after EXECUTE.

Source Error:

Line 97: dbConnection.Open()
Line 98:
Line 99: Dim dataReader As System.Data.oledb.OleDbDataReader = dbCommand.ExecuteReader()

Here's my code:
    Function drGetClasses(ByVal ClassNo As Integer) As System.Data.oledb.OleDbDataReader
        Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(DBCalls.connecti onstring)

        Dim QueryString As String

        QueryString = "SELECT * From qryClasses" ' & ClassNo

        Dim dbCommand As New OleDb.OleDbCommand
        dbCommand.CommandText = QueryString
        dbCommand.Connection = dbConnection
        dbCommand.CommandType = CommandType.StoredProcedure
        dbCommand.Parameters.Add("@ClassNo", System.Data.OleDb.OleDbType.Integer)
        dbCommand.Parameters("@ClassNo").Value = ClassNo


        Dim dataReader As System.Data.oledb.OleDbDataReader = dbCommand.ExecuteReader()

        Return dataReader
    End Function
Thank You.

Similar Threads
Thread Thread Starter Forum Replies Last Post
System.Data.OleDb.OleDbException: No value given f tjgrindsted ASP.NET 2.0 Basics 0 January 24th, 2007 07:25 AM
An unhandled exception of type 'System.Data.OleDb. Harvey_swift VB Databases Basics 1 May 30th, 2006 12:57 PM
using oledb to retrieve data from sql server w A2K nikesierra2306 Access VBA 0 October 20th, 2004 04:36 PM
OleDbException (0x80004005): Confused ASP.NET 1.0 and 1.1 Basics 13 April 24th, 2004 11:21 PM

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