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 January 19th, 2005, 06:51 PM
Authorized User
 
Join Date: Jan 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Database Connection Error

Newb in trouble!
I would like for this page to display certain fields of my access database but seem to be stuck!
I receive the following error whrn trying to connect to my database
ADODB.Recordset error '800a0e7d'

The connection cannot be used to perform this operation. It is either closed or invalid in this context.

[path]/asp/dbman/search1.asp, line 8

Any help would be appreciated

Code:
<%@Language = "VbScript"%>
<%
dim objConn,objRec 
set objConn=Server.CreateObject("ADODB.Connection")
objConn.Provider="Microsoft.Jet.OLEDB.4.0"
objConn.Open "[path]//asp/temp/toast/data/cap.mdb"
 Set objRec = Server.CreateObject ("ADODB.Recordset")  
 objRec.Open "member"

  While NOT objRec.EOF 
  Response.Write objRec("ID") & ", " 
  Response.Write objRec("Fname") & ", " 
  Response.Write objRec("LName") & ", " 
  Response.Write objRec("Uname") & "<BR>" 
  objRec.MoveNext 
  Wend 
  %>
  <HTML>
  <HEAD>
  </HEAD>
  <Body>
  </Body>
  </HTML>
Thanks
 
Old January 19th, 2005, 09:02 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

  Invalid arguments in the recordset open


Set objRec = Server.CreateObject ("ADODB.Recordset")
 objRec.Open "member",objConn



-----------
Rajani

 
Old January 20th, 2005, 12:20 PM
Authorized User
 
Join Date: Jan 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a bunch i am able to get into the script now but im receivinq an SQL error
Microsoft JET Database Engine error '80040e14'

Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.


Thoughts?


 
Old January 20th, 2005, 12:24 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Try setting the options parameter to adCmdTable...
Code:
objRec.Open "member", objConn, , , adCmdTable
HTH,

Chris

 
Old January 20th, 2005, 12:27 PM
Authorized User
 
Join Date: Jan 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for a quick response
I tried inputting this string but receive the same error thought?

 
Old January 20th, 2005, 12:36 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Have you referenced the ado constants in your page?

 
Old January 20th, 2005, 12:46 PM
Authorized User
 
Join Date: Jan 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oops I had not but now that I have I get the following error
Microsoft JET Database Engine error '80040e14'

Syntax error in FROM clause.

[path]/Hot Topic.asp, line 14

The database was made from a comma delimited text document it is only a test database it was converted with access 2002
 
Old January 20th, 2005, 01:14 PM
Authorized User
 
Join Date: Jan 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK I created a new database with access but i am still getting this error
Microsoft JET Database Engine error '80040e14'

Syntax error in FROM clause.

[path]/Hot Topic.asp, line 14
here is my code line 14(objRec.Open "Hot%20topic",objConn, , , adCmdTable) seems to be the trouble?
Code:
<HTML>
  <HEAD>
  </HEAD>
  <Body>
  
<%@Language = "VbScript"%>

<%
dim objConn,objRec 
set objConn=Server.CreateObject("ADODB.Connection")
objConn.Provider="Microsoft.Jet.OLEDB.4.0"
objConn.Open "[path]/hot topics.mdb"
 Set objRec = Server.CreateObject ("ADODB.Recordset")  
 objRec.Open "Hot%20topic",objConn, , , adCmdTable
  While NOT objRec.EOF 
  Response.Write objRec("ID") & ", " 
  Response.Write objRec("Date") & ", " 
  Response.Write objRec("Control") & ", " 
  Response.Write objRec("Company") & ", " 
  Response.Write objRec("Comments") & "<BR>" 
  objRec.MoveNext 
  Wend 
  %>
  </Body>
  </HTML>
 
Old January 20th, 2005, 01:20 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Do you have a table in your database called "Hot%20topic"?

 
Old January 20th, 2005, 01:28 PM
Authorized User
 
Join Date: Jan 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes it is called Hot Topic but when I leave out the %20 it says no query or table found named "Hot"
I assumed I spelled a field wrong but they are all correct!

Thoughts






Similar Threads
Thread Thread Starter Forum Replies Last Post
Database connection error......Page not loading??? ankur_icfai ASP.NET 2.0 Basics 2 January 25th, 2007 09:12 AM
Database connection error lappling General .NET 0 April 20th, 2006 07:48 AM
Database connection error help me hasham Pro JSP 1 March 21st, 2006 08:38 AM
Server error for database connection frankv25 ASP.NET 1.0 and 1.1 Basics 5 August 14th, 2004 07:33 AM





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