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
  #1 (permalink)  
Old April 3rd, 2006, 01:22 AM
Authorized User
 
Join Date: Nov 2005
Location: , , Spain.
Posts: 72
Thanks: 3
Thanked 0 Times in 0 Posts
Default What is wrong with code?

Hi,

I have the nect code:
===
Set conn_clip = server.createobject("adodb.connection")
conn_clip.open "DSN=DBMINE"
set rs_clip = server.createobject("adodb.recordset")

sql_clip="SELECT * FROM MAE_LAL WHERE COD_ALB=1 "
rs_clip.open sql_clip,conn_clip

rs_clip.close
Conn_clip.Close
Set rs_clip=Nothing
Set Conn_clip=Nothing
===

It works fine, but whenever I put the lines of the SQL inside a bucle, like this:

==
Set conn_clip = server.createobject("adodb.connection")
conn_clip.open "DSN=DBMINE"
set rs_clip = server.createobject("adodb.recordset")

FOR counter=1 to 20
sql_clip="SELECT * FROM MAE_LAL WHERE COD_ALB=1 "
rs_clip.open sql_clip,conn_clip

NEXT

rs_clip.close
Conn_clip.Close
Set rs_clip=Nothing
Set Conn_clip=Nothing

====
It gives me an error

"The operation is not poissble if object is open (Translated from spanish, sorry)

So I tried to put the lines
===
rs_clip.close
Conn_clip.Close
===
behind the code
===
rs_clip.open sql_clip,conn_clip
===
So it opens and closes it every time, but it gives me also an error.


What I want to do is to read from a DBF (CLIPPER) files, get some data and write it into an SQL file (other part of code, not written here).


WHAT am I doing wrong?????

Thx,

Johny

  #2 (permalink)  
Old April 3rd, 2006, 03:20 AM
Authorized User
 
Join Date: Mar 2006
Location: Aberdeen, Scotland, United Kingdom.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Veamos Tio,

El error original te dio porque tratabas de abrir el objeto dos veces y tu correccion fue logica.

Sin embargo, no entiendo porque quieres meter esas instrucciones dentro de un bucle (si siempre es el mismo query string!??!; a menos que nos estes simplificando tu codigo... Asi como esta puesto, yo sacaria el comando Open del bucle...

Si simplificaste el codigo, envianos algo mas del original.

Saludos - Joel


Similar Threads
Thread Thread Starter Forum Replies Last Post
what's wrong with my code? DyerOppenheimer BOOK: Beginning Ajax with ASP.NET 0 January 7th, 2008 08:46 AM
What's wrong with this code? appleseed C++ Programming 2 November 25th, 2006 08:17 AM
What's wrong with this code? AlDugan XSLT 3 May 19th, 2006 12:06 PM
What is wrong with this code? SaharaWizard VB Databases Basics 2 January 28th, 2006 08:20 AM
what's wrong with this code? miguel.ossa ASP.NET 1.0 and 1.1 Basics 2 January 21st, 2004 11:33 AM





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