Use of command object

Results 1 to 2 of 2

Thread: Use of command object

  1. #1
    Join Date
    Dec 1969

    Default Use of command object

    Hi,<BR><BR>can anybody tell me what I am doing wrong here. I am trying to use a command object for my query and I get no records found but if I use the same query using only connection object than it works.<BR><BR>set sub1 = server.createobject("ADODB.Connection")<BR>sub1.op en "product1"<BR>set cm = server.CreateObject("ADODB.Command")<BR>set cm.ActiveConnection = sub1<BR><BR>Dim rs1<BR>set rs1 = server.CreateObject("ADODB.Recordset")<BR><BR>cm.c ommandtext = "select distinct,,y.description__1,y.description__2"<BR>cm.comma ndtext =cm.commandtext & " from product.p-attribute y inner join product.p-product x on ( <BR>cm.commandtext= cm.commandtext & " where (y.description__1 like &#039;?&#039; or y.description__2 like &#039;?&#039;) and not like &#039;b%&#039; and like &#039;?&#039; and like &#039;?&#039;"<BR><BR>cm.Prepared = True<BR>cm.Parameters.Append cm.CreateParameter("des",200,,30,"%"& p_tt &"%")<BR>cm.Parameters.Append cm.CreateParameter("des1",200,,30,"%"& p_tt &"%")<BR>cm.Parameters.Append cm.CreateParameter("id",adVarChar,,30,"%"& p_pid &"%")<BR>cm.Parameters.Append cm.CreateParameter("rel",adVarChar,,30,""& p_rel &"%")<BR><BR> set rs1 = cm.execute<BR><BR>Thanks,<BR>archna

  2. #2
    Join Date
    Dec 1969

    Default RE: Use of command object

    do u want to execute a sql query or a stored proc? u r mixing things and also missing some other properties of command object.better to chek some documentation on command object

Posting Permissions

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