Returning a value from a SQL Execute

Results 1 to 3 of 3

Thread: Returning a value from a SQL Execute

  1. #1
    Join Date
    Dec 1969

    Default Returning a value from a SQL Execute

    Is there any usable return value from a sql query execute statment and if so, how do I use it?<BR><BR>I&#039ve tried the obvious:<BR><BR>respVal = dataConnection.Execute(sqlStatmenent)<BR><BR>But I can&#039t figure out what format respVal is in once the statement has been executed.<BR><BR>Anyone?<BR>-<BR>Scott Smith

  2. #2
    Join Date
    Dec 1969

    Default RE: Returning a value from a SQL Execute

    If you just want to return the SQL statment here&#039s an easy way:<BR><BR>response.write sqlStatement<BR><BR>If not, then could please be more specific...because all you will get when you response.write respVal is something to this effect:<BR><BR>dataConnection.Execute("select * from mytable")<BR><BR>so I&#039m not sure what you&#039re getting at...

  3. #3
    SPG Guest

    Default RE: Returning a value from a SQL Execute

    Two possible results:<BR>1) A recordset (generally empty & closed if you were sending a command instead of a selection) or<BR>2) An error (which will probably also return an empty and closed recordset, but it will also give you a dirty glare!)<BR><BR>To get a useful status update from an .execute, I put mine in a little routine... (this should be the VBScript equivalent -- mine&#039s in VB as the error handling is nicer; this assumes you&#039re using objConn for your connection.)<BR><BR>littleRoutine(strCommand)<BR> on error resume next<BR> objConn.execute strCommand<BR> if err.number &#060;&#062; 0 then<BR> response.write err.description<BR> littleRoutine = false<BR> else <BR> littleRoutine = true<BR> end if<BR>end function<BR><BR>HiH

Posting Permissions

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