View Single Post
 
Old April 3rd, 2006, 01:22 AM
rtr1900 rtr1900 is offline
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