Creating and object

Results 1 to 3 of 3

Thread: Creating and object

  1. #1
    Nathan Masek Guest

    Default Creating and object

    This is how I create an object now:<BR><BR>sql = "SELECT * FROM table_name"<BR>Set rs = Server.CreateObject("ADODB.Recordset")<BR> hdrsql, conn<BR><BR>Should I be doing this:<BR><BR>Set rs = conn.execute sql<BR><BR>or are they the same?

  2. #2
    Join Date
    Dec 1969

    Default RE: Creating and object

    better way to execute your sql:<BR><BR>Set CN1 = Server.CreateObject("ADODB.Connection") <BR>If CN1.State &#060;&#062; 0 Then<BR> CN1.Close<BR>End If<BR><BR> "Provider=xxxxxx;Persist Security Info=False;Data Source=......................."<BR><BR>SQL = "Select * from .....where...."<BR>Set RS = CN1.Execute(SQL,ra)<BR>if ra&#062;0 then<BR> &#039success<BR>else<BR> &#039error<BR>end if<BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Creating and object

    You do not necessarily need a connection object. the recordset object can make a connection alone. but if you do use one, you don&#039t actually use the sql statement in the connection since you are already using it in the recordset connection. set up the connection first and use that connection to as part of the sql,conn_name
    Last edited by Jay; 04-16-2011 at 01:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts