Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Closed Recordset?
Message
General information
Forum:
Visual C++
Category:
Other
Miscellaneous
Thread ID:
00250082
Message ID:
00250588
Views:
17
Well, good programming practice is to create an object at the last minute and destroy the object as soon as you are finished with it. However it is true that any local variables or objects created in a page are released and/or destroyed once the script finishes processing.

>I tried what you said and it works great! Thanks! Another solution presented by a friend said that I had to remove the html codes (the head, html, body tags, etc.) surrounding the script and then remove the new_rs.Close. It also worked however i'm in doubt about this method - removing the new_rs.Close.
>What happens to that recordset? Does it get closed automatically? Should I close db_conn too?
>
>Thanks again!
>
>Carlos
>
>
>>Perfect! Now here is an example of when you need to use the Connection object! When you use the Recordset.Open method, ADO expects to get records back from the data source. Since you are doing an Insert, there aren't any records coming back and so you get the error (although the error message doesn't really help you to know that).
>>
>>The way to do this is to use the Execute method of the Connection object. The code would look something like this:
>>
>>' Create insert statement
>>new_qry = "Insert into cmts_unit_invty values('" & myvar1 & "'," & myvar2 & ")"
>>
>>' Create Connection object
>>Set db_conn = Server.CreateObject("ADODB.Connection")
>>
>>' Open connection using DSN
>>db_conn.Open "DSN=mydsn;UID=myid;PWD="
>>
>>' Send the insert statement to the back end
>>db_conn.Execute new_qry
>>
>>HTH
"It is an important and popular fact that things are not always what they seem. For instance, on the planet Earth, man had always assumed that he was more intelligent than dolphins because he had achieved so much -- the wheel, New York, wars and so on -- whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man -- for precisely the same reasons." - Douglas Adams
Previous
Reply
Map
View

Click here to load this message in the networking platform