Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: No Results from Parameter Queries with OLEDB (ODBC is Fine)


Message #1 by "Dominic Chambers" <dominic.chambers@b...> on Sun, 13 Jan 2002 19:40:28
Can anyone help?



I have an application that works great with ODBC but must be upgraded for 

OLEDB. Everything works fine except no results are returned from the 

parameter queries. Action type parameter queries work fine.







Code Snippet:



function executeQuery(queryName, queryType, parameters)

{

  var commandObj;

  var nextParam;

  var count;

  var rs;

  

  // Log the query

  logQuery(queryName, queryType, parameters);

   

  // Instantiate command object

  commandObj = Server.CreateObject("ADODB.Command");

  

  // Ready command object

  commandObj.ActiveConnection = this.adoCon;

  commandObj.CommandText = queryName;

  commandObj.CommandType = adCmdStoredProc;

  

  // Add Input Parameters

  for(count = 0; count < parameters.length; count++)

  {

    nextParam = commandObj.CreateParameter(

      parameters[count].name,

      parameters[count].type,

      adParamInput,

      parameters[count].length,

      parameters[count].value);

    

    commandObj.Parameters.Append(nextParam);

  }

  

  if(queryType == dbQuery)

    // Plain Query

  {

    // Execute Query

    rs = Server.CreateObject("ADODB.Recordset");

    rs.CursorType = adOpenForwardOnly;

    rs.LockType = adLockReadOnly;

    rs.Open(commandObj);

  }

  else

    // Action Query

  {

    // Execute Query

    commandObj.Execute();

  }



  // Return RecordSet

  return rs;

}
Message #2 by "Auratius February" <af1@c...> on Tue, 15 Jan 2002 13:08:34
Hi there



Well I would really like to assist.



Are you using Access or SQL?

Are you moving to SQL or to Access?



If this is the case then I think I might advice you.



Regards



Auratius February



> Can anyone help?

> 

> I have an application that works great with ODBC but must be upgraded 

for 

> OLEDB. Everything works fine except no results are returned from the 

> parameter queries. Action type parameter queries work fine.

> 

> 

> 

> Code Snippet:

> 

> function executeQuery(queryName, queryType, parameters)

> {

>   var commandObj;

>   var nextParam;

>   var count;

>   var rs;

>   

>   // Log the query

>   logQuery(queryName, queryType, parameters);

>    

>   // Instantiate command object

>   commandObj = Server.CreateObject("ADODB.Command");

>   

>   // Ready command object

>   commandObj.ActiveConnection = this.adoCon;

>   commandObj.CommandText = queryName;

>   commandObj.CommandType = adCmdStoredProc;

>   

>   // Add Input Parameters

>   for(count = 0; count < parameters.length; count++)

>   {

>     nextParam = commandObj.CreateParameter(

>       parameters[count].name,

>       parameters[count].type,

>       adParamInput,

>       parameters[count].length,

>       parameters[count].value);

>     

>     commandObj.Parameters.Append(nextParam);

>   }

>   

>   if(queryType == dbQuery)

>     // Plain Query

>   {

>     // Execute Query

>     rs = Server.CreateObject("ADODB.Recordset");

>     rs.CursorType = adOpenForwardOnly;

>     rs.LockType = adLockReadOnly;

>     rs.Open(commandObj);

>   }

>   else

>     // Action Query

>   {

>     // Execute Query

>     commandObj.Execute();

>   }

> 

>   // Return RecordSet

>   return rs;


  Return to Index