Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

RecSet.Open

How do i open RecSet.Open ? Or rather what parameters do i use?
Just "RecSet.Open" gives me nothing but this error message:

Action is not allowed on an object that refers to a closed or illegal connection
/login.asp, line 64

(roughly translated from swedish)


Comments

  • vanithvanith Posts: 44Member
    [b][red]This message was edited by vanith at 2002-9-25 14:39:49[/red][/b][hr]
    : How do i open RecSet.Open ? Or rather what parameters do i use?
    : Just "RecSet.Open" gives me nothing but this error message:
    :
    : Action is not allowed on an object that refers to a closed or illegal connection
    : /login.asp, line 64
    :
    : (roughly translated from swedish)
    :
    :
    :

    hi!

    Syntax for using an ADO Recordset object.
    recordset.Open Source, ActiveConnection, CursorType, LockType, Options

    But all of these parameters are optional, which means either some of them have default values or you can specify them individualy by setting the respective properties like
    recordset.Source = "Select * from employee"
    Set recordset.ActiveConnection = connectionobject

    recordset.CursorType = 2 'adOpenDynamic
    recordset.LockType = 1 'adLockReadOnly

    then simply calling the recordset.open will open the recordset object.

    CursorType, LockType, Options have default values but Source and ActiveConnection must be specified before opening a Recordset. ActiveConnection is a ADODB.Connection object which must have been opened before you set the ActiveConnection property to the recordset.

    For more Info refer
    http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthrstopen.asp

    sample code
    -----------
    [code]
    dim cn, rs
    Set cn = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("ADODB.Recordset")
    cn.Open "DSNNAME","IUSRNAME","IUSRPWD"

    rs.open "select * from tablename", cn

    rs.close
    cn.close

    Set rs = Nothing
    Set cn = Nothing
    [/code]

    :)heers,
    vanith



Sign In or Register to comment.