Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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

Reply With Quote
  #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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:33 AM.


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