|
Subject:
|
System.Data.OleDb.OleDbException: Expected query n
|
|
Posted By:
|
Thac
|
Post Date:
|
7/3/2005 1:48:37 PM
|
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.connectionstring)
Dim QueryString As String
QueryString = "SELECT * From qryClasses" ' & ClassNo System.Data.OleDb.OleDbCommand
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
dbConnection.Open()
Dim dataReader As System.Data.oledb.OleDbDataReader = dbCommand.ExecuteReader()
Return dataReader End Function Thank You. Thac
|
|