ASP Command object isn't closed in DW code?

Hi,
I have recently noticed that the Pagefile useage on one of my
servers runs
high most of the time. I am wondering if this is due to
memory leakage from
the fact that my DW generated code doesn't explicitly close
the Command
object in the ASP code.
Does anyone know if this could be helped by setting the
Comand object '=
Nothing' at the end of the script or is there another way.
I am using DWMX2005 - Classic ASP to a SQL Server 2000 db.
Thanks.

Your right I think Ray Wet or Tom Muck Came up with a
extension to do just
that, I think Adobe could have included this with the 8.02 up
date that
fixed the SQL injection issue. Hope some of this will be
included in the
next version.
Dave
"Pat Shaw" <[email protected]> wrote in message
news:[email protected]...
> Yes, I totally agree, so why doesn't DWMX do this for
you? I remember in
> UltraDev1 (for those who can remember back that far),
the rs was not
closed
> at the bottom of the page and this was corrected in UD4
which was the next
> version.
>
> "Baxter" <baxter(RemoveThe :-)@gtlakes.com> wrote
in message
> news:[email protected]...
> >I have always been under the impression that every
thing needs to be
closed
> > including all objects, Command, CDO etc.
> > set commandobject=nothing // destroy the command
object
> > Including all connections, recoredset's and so on.
> > Some helpful information
> >
http://www.aspfaq.com/params.htm
> > Dave
> >
> >
> > "Pat Shaw" <[email protected]> wrote in message
> > news:[email protected]...
> >> Thanks but this is different. I am talking
about the Command object.
> >>
> >> "Baxter" <baxter(RemoveThe
:-)@gtlakes.com> wrote in message
> >> news:[email protected]...
> >> > Hi! Pat
> >> > I always add this to the end of my asp
pages.
> >> >
> >> > </body>
> >> > </html>
> >> > <%
> >> > rsYourRecordset.Close()
> >> > %>
> >> >
> >> > Dave
> >> > "Pat Shaw" <[email protected]> wrote in
message
> >> > news:[email protected]...
> >> >> Hi,
> >> >>
> >> >> I have recently noticed that the
Pagefile useage on one of my
servers
> >> >> runs
> >> >> high most of the time. I am wondering
if this is due to memory
leakage
> >> > from
> >> >> the fact that my DW generated code
doesn't explicitly close the
> >> >> Command
> >> >> object in the ASP code.
> >> >>
> >> >> Does anyone know if this could be
helped by setting the Comand
object
> > '=
> >> >> Nothing' at the end of the script or
is there another way.
> >> >>
> >> >> I am using DWMX2005 - Classic ASP to a
SQL Server 2000 db.
> >> >>
> >> >> Thanks.
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>

Similar Messages

  • [Sybase JDBC Driver]Object has been closed

    Hi,
    I am getting the following error when accessing a datasource in an EJB on Weblogic using the Data Direct Drivers.
    java.sql.SQLException: [DataDirect][Sybase JDBC Driver]Object has been closed.
    The code works every other time. the first time through it works the second time I get the error.
    Any insite would be appricated.
    Here is my code
    public String test(String id)
    System.out.println ("test1");
    DataSource ds = null;
    Connection conn = null;
    PreparedStatement stmt = null;
    PreparedStatement stmt2 = null;
    String ret = "?????";
    try
    System.out.println ("read data - prepare");
    InitialContext ic = new InitialContext();
    ds = (DataSource)ic.lookup("java:comp/env/jdbc/dataconn");
    conn = ds.getConnection();
    String sql = "SELECT * FROM myTable WHERE ID = ?";
    System.out.println ("read data - conn.prepareStatement(sql);");
    stmt = conn.prepareStatement(sql);
    stmt.setString(1, id);
    // stmt.setMaxRows(1000);
    System.out.println ("read data - stmt.executeQuery();");
    ResultSet rs = stmt.executeQuery();
    System.out.println ("read data - read");
    if(!rs.next())
    ret = "Not found";
    else
    ret = "found";
    sql = "UPDATE myTable SET column1 = column1 + 1 WHERE ID = ?";
    System.out.println ("update data - prepare");
    stmt2 = conn.prepareStatement(sql);
    stmt2.setString(1, id);
    ret = ret + stmt2.executeUpdate();
    System.out.println ("update data - update");
    catch(Exception e)
    e.printStackTrace();
    finally
    try
    stmt.close();
    catch(Exception exception1) { }
    try
    stmt2.close();
    catch(Exception exception1) { }
    try
    conn.close();
    catch(Exception exception1) { }
    stmt = null;
    stmt2 = null;
    conn = null;
    return ret;
    }

    Hi. What version of weblogic, and can you print the whole stacktrace?
    That way I'll know which object is already closed. This hints at an
    already-fixed bug, but I'm not sure yet... And tell me what happens
    if you close your result set after you do your call to next(). Lastly,
    you can save some DBMS traffic if you change the query to:
    "SELECT 1 FROM myTable WHERE ID = ?"
    Then regardless of how wide the table is, and whether the table data
    is in DBMS memory, as long as there's an index on ID, the query only
    needs to use the index, not the data page to answer. If there's an
    index entry for your ID value, you'll get one row with 1 in it, else
    nothing.
    thanks
    Joe
    Scot McReynolds wrote:
    Hi,
    I am getting the following error when accessing a datasource in an EJB on Weblogic using the Data Direct Drivers.
    java.sql.SQLException: [DataDirect][Sybase JDBC Driver]Object has been closed.
    The code works every other time. the first time through it works the second time I get the error.
    Any insite would be appricated.
    Here is my code
    public String test(String id)
    System.out.println ("test1");
    DataSource ds = null;
    Connection conn = null;
    PreparedStatement stmt = null;
    PreparedStatement stmt2 = null;
    String ret = "?????";
    try
    System.out.println ("read data - prepare");
    InitialContext ic = new InitialContext();
    ds = (DataSource)ic.lookup("java:comp/env/jdbc/dataconn");
    conn = ds.getConnection();
    String sql = "SELECT * FROM myTable WHERE ID = ?";
    System.out.println ("read data - conn.prepareStatement(sql);");
    stmt = conn.prepareStatement(sql);
    stmt.setString(1, id);
    // stmt.setMaxRows(1000);
    System.out.println ("read data - stmt.executeQuery();");
    ResultSet rs = stmt.executeQuery();
    System.out.println ("read data - read");
    if(!rs.next())
    ret = "Not found";
    else
    ret = "found";
    sql = "UPDATE myTable SET column1 = column1 + 1 WHERE ID = ?";
    System.out.println ("update data - prepare");
    stmt2 = conn.prepareStatement(sql);
    stmt2.setString(1, id);
    ret = ret + stmt2.executeUpdate();
    System.out.println ("update data - update");
    catch(Exception e)
    e.printStackTrace();
    finally
    try
    stmt.close();
    catch(Exception exception1) { }
    try
    stmt2.close();
    catch(Exception exception1) { }
    try
    conn.close();
    catch(Exception exception1) { }
    stmt = null;
    stmt2 = null;
    conn = null;
    return ret;

  • The selected objects cannot be joined as they are invalid objects,( Compound paths, closed paths, Text Objects, Graphs, Live Paint group). You can use Join command to connect two or more paths, paths in groups; ot to close an open path.

    Hi I was trying to join two Ractangle Tool objects but getting this type of Error in illustrator cs6 :-
    The selected objects cannot be joined as they are invalid objects,( Compound paths, closed paths, Text Objects, Graphs, Live Paint group).
    You can use Join command to connect two or more paths, paths in groups; ot to close an open path.
    Please assist me asap.

    Yes, I know this is an old post, but I’m trying to clean them up. Did you solve this problem, if so what was the solution?
    This sound like a firewall issue. I would start by disabling the firewall and seeing if you can connect. If this works then you know where the problem is,
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

  • Why the step-and-repeat function (command+d) isn't working in Illustrator CS5?

    Why the step-and-repeat function (command+d) isn't working in Illustrator CS5?
    I am trying this. Take an object, move it some inches on the right while holding the option key, so I duplicate it.
    Usually, I pressed on command+d to duplicate this action on and on (duplicate the object and moving it some inches away), but now it is not working.
    any idea?

    kwakoo,
    It may be time for the list:
    The following is a general list of things you may try when the issue is not in a specific file, and when it is not caused by issues with opening a file from external media. You may have tried/done some of them already; 1) and 2) are the easy ones for temporary strangenesses, and 3) and 4) are specifically aimed at possibly corrupt preferences); 5) is a list in itself, and 6) is the last resort.
    If possible/applicable, you should save current artwork first, of course.
    1) Close down Illy and open again;
    2) Restart the computer (you may do that up to at least 5 times);
    3) Close down Illy and press Ctrl+Alt+Shift/Cmd+Option+Shift during startup (easy but irreversible);
    4) Move the folder (follow the link with that name) with Illy closed (more tedious but also more thorough and reversible), for CS3 - CC you may find the folder here:
    https://helpx.adobe.com/illustrator/kb/preference-file-location-illustrator.html
    5) Look through and try out the relevant among the Other options (follow the link with that name, Item 7) is a list of usual suspects among other applications that may disturb and confuse Illy, Item 15) applies to CC, CS6, and maybe CS5);
    Even more seriously, you may:
    6) Uninstall (ticking the box to delete the preferences), run the Cleaner Tool (if you have CS3/CS4/CS5/CS6/CC), and reinstall.
    http://www.adobe.com/support/contact/cscleanertool.html

  • Command object locks table (TX)

    Im having locking probmlems with ODP.NET. Im updating same table with many connections in many threads. I get table locks for hours (over 24 hours) and I cant find any timout to set. The CommandTimeout on the Command object is not implemented.
    In the V$Lock table I can see two locks on the same table made by two session ids from the same computer.
    Im using transactions on the Connection object.
    How do I set a timout for the update so that the lock will dissapear?
    String connString = "Data Source="     + dsn + ";"
              + "User ID="          + user + ";"
              + "Password="          + pwd;
    OracleConnection conn = new OracleConnection(connString);
    String sql = "UPDATE ABDATA2 SET ABNAVN='SOLNA STAD ' WHERE OBJID = -21805738";
    OracleCommand command = new OracleCommand(sql, m_conn);
    //command.CommandTimeout = 60000; Exists but not supported
    command.ExecuteNonQuery();
    Is there anyone who has a clue?

    Hi Neo, thanks for responding;
    I did not publish the report with saved data, and I'm not sure what you mean about appending the string value?  Could you explain that part?
    The parameter I created is only declared as a string with no default value with a name of "CodeTableName".  I used the Create paramter button you have in the Command object window to make it.
    I then added the parameter name to my SQL statement as listed above.
    The actual code table names in the database is actually longer then what the parameter calls for.  They all start with "TIBURON.ZZ_" and end with "_Codes".  I didn't want the users to have to remember the full names so that's why the SQL statement shows those additional parts.
    The report works perfect when I'm running this report from Crystal Reports 9 or CR11 itself.  It's only when I upload the report to our web server that the users isn't provided a prompt to enter a parameter.  They only have button labed "Run Report".
    Any ideas?
    Thanks,
    Joe

  • Command Object Source

    I have recently moved from Dreamweaver MX (2003) to CS3. In
    MX, a recordset object was used to query the database. To
    troubleshoot a query,
    Dim SelectedPrimary
    Dim SelectedPrimary_numRows
    Set SelectedPrimary = Server.CreateObject("ADODB.Recordset")
    SelectedPrimary.ActiveConnection = MM_connClusterDB_STRING
    SelectedPrimary.Source = "SELECT O.OfficeID, O.ShortOffice
    FROM tbl_Offices O WHERE OfficeID = '" +
    Replace(SelectedPrimary__OffID, "'", "''") + "' ORDER BY
    OfficeName"
    SelectedPrimary.CursorType = 0
    SelectedPrimary.CursorLocation = 2
    SelectedPrimary.LockType = 1
    SelectedPrimary.Open()SelectedPrimary_numRows = 0
    before "SelectedPrimary.Open()" I would add...
    Response.Write SelectedPrimary.Source
    Response.End()
    run the page and copy the code (
    SELECT O.OfficeID, O.ShortOffice FROM tbl_Offices O WHERE
    OfficeID = 7 ) into Query Analyzer
    Is there a similar function to write out the code to a page
    for troubleshooting a Command Object query that is used in
    Dreamweaver CS3?
    Other than repeatedly filling out the 4 items (Name, Type,
    Value and Default value) over and over,
    how do you make the Command Object to use the same variable,
    several times in one query?
    Dreamweaver CS3 | ASP | SQL SERVER
    -- Steve

    Stevan2002 wrote:
    > before "SelectedPrimary.Open()" I would add...
    >
    > Response.Write SelectedPrimary.Source
    > Response.End()
    >
    > run the page and copy the code (
    SELECT O.OfficeID, O.ShortOffice FROM
    > tbl_Offices O WHERE OfficeID = 7 ) into Query
    Analyzer
    >
    > Is there a similar function to write out the code to a
    page for
    > troubleshooting a Command Object query that is used in
    Dreamweaver CS3?
    Unfortunately as far as I'm aware, with the command object
    and the parameters it uses you can't get the actual SQL that is
    submitted to the database, you can only get the SQL with the ?
    tokens where the values are supposed to be inserted. However, if
    you want to try to recreate the generated SQL, try something like
    the following. Look for this line of code:
    Set Recordset1 = Recordset1_cmd.Execute
    Just above it add the following (substitute your recordset
    name for Recordset1 below):
    ' Should work for Access and SQL Server, other DBs are
    questionable
    Dim cmd : Set cmd = Recordset1_cmd
    Dim cmdSQL: cmdSQL = cmd.CommandText
    Dim cmdParam
    for each param in cmd.Parameters
    val = param.Value
    If(param.Type = 200) Then ' If text
    val = """" & val & """"
    End If
    If(param.Type = 135) Then ' If date
    val = "'" & val & "'"
    End If
    cmdSQL = Replace(cmdSQL, "?", val, 1, 1)
    next
    Response.Write(cmdSQL &"<br />")
    Note this likely will only work with Dreamweaver parameters
    created within the Recordset dialog.
    > Other than repeatedly filling out the 4 items (Name,
    Type, Value and Default
    > value) over and over,
    > how do you make the Command Object to use the same
    variable, several times in
    > one query?
    Within the Dreamweaver UI, that's the way you do it. If you
    want to do it in the code, you can copy and paste the parameter
    code above the recordset, change the name slightly, like appending
    2, 3, then 4. Then you'd need to add an extra Parameters and update
    the "param1" to 2, 3, and 4.
    Danilo Celic
    | Extending Knowledge Daily :
    http://CommunityMX.com/
    | Adobe Community Expert

  • Command Object Insert error

    Hi, I am having trouble trying to figure out an error I have
    with DW created Command Object. The error is below:
    Microsoft OLE DB Provider for SQL Server error '80040e14'
    Incorrect syntax near ')'.
    /labeldivision/Customer/AddCreditCard.asp, line 37
    Here is the code:
    <%
    if(request("NameOnCard") <> "") then Command1__Name =
    request("NameOnCard")
    %>
    <%
    set Command1 = Server.CreateObject("ADODB.Command")
    Command1.ActiveConnection = MM_ASPConn_STRING
    Command1.CommandText = "INSERT INTO dbo.TblCreditCard
    (NameOnCard) VALUES (" + Replace(Command1__Name, "'", "''") + ") "
    Command1.CommandType = 1
    Command1.CommandTimeout = 0
    Command1.Prepared = true
    Command1.Execute()
    %>
    I have looked all over trying to figure this out. I think it
    must e something to do with the quotes but this is exactly the way
    that DW wrote it.

    Check that the database field is set up to accept text.
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "xybernaut" <[email protected]> wrote in
    message
    news:ee6b9q$r13$[email protected]..
    > Hi, I am having trouble trying to figure out an error I
    have with DW
    > created
    > Command Object. The error is below:
    >
    > Microsoft OLE DB Provider for SQL Server error
    '80040e14'
    >
    > Incorrect syntax near ')'.
    >
    > /labeldivision/Customer/AddCreditCard.asp, line 37
    >
    > Here is the code:
    >
    > <%
    >
    > if(request("NameOnCard") <> "") then
    Command1__Name =
    > request("NameOnCard")
    >
    > %>
    > <%
    >
    > set Command1 = Server.CreateObject("ADODB.Command")
    > Command1.ActiveConnection = MM_ASPConn_STRING
    > Command1.CommandText = "INSERT INTO dbo.TblCreditCard
    (NameOnCard) VALUES
    > ("
    > + Replace(Command1__Name, "'", "''") + ") "
    > Command1.CommandType = 1
    > Command1.CommandTimeout = 0
    > Command1.Prepared = true
    > Command1.Execute()
    >
    > %>
    >
    > I have looked all over trying to figure this out. I
    think it must e
    > something
    > to do with the quotes but this is exactly the way that
    DW wrote it.
    >
    >

  • Using a Variable in SSIS - Error - "Command text was not set for the command object.".

    Hi All,
    I am using a OLE DB Source in my dataflow component and want to select SQL Query from the master table  I have created variables v_Archivequery
    String packageLevel (to store the query).
    <Variable Name="V_Archivequery" DataType="String">
         SELECT a.*, b.BBxKey as Archive_BBxKey, b.RowChecksum as Archive_RowChecksum
         FROM dbo.ImportBBxFbcci a LEFT OUTER JOIN Archive.dbo.ArchiveBBxFbcci b
         ON (SUBSTRING(a.Col001,1,4) + SUBSTRING(a.Col002,1,10)) = b.BBxKey
         Where (b.LatestVersion = 1 OR b.LatestVersion IS NULL)
        </Variable>
    I am assigning this query to the v_Archivequery variable, "SELECT a.*, b.BBxKey as Archive_BBxKey, b.RowChecksum as Archive_RowChecksum
    FROM dbo.ImportBBxFbcci a LEFT OUTER JOIN Archive.dbo.ArchiveBBxFbcci b
     ON (SUBSTRING(a.Col001,1,4) + SUBSTRING(a.Col002,1,10)) = b.BBxKey
    Where (b.LatestVersion = 1 OR b.LatestVersion IS NULL)"
    Now in the OLE Db source, I have selected as Sql Command from Variable, and I am getting the variable, v_Archivequery .
    But when I am generating the package and when running I am getting bewlo errror
     Error at Data Flow Task [OLE DB Source [1]]: An OLE DB error has occurred. Error code: 0x80040E0C.
    An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80040E0C  Description: "Command text was not set for the command object.".
    Can Someone guide me whr am going wrong?
    Please let me know where am going wrong?
    Thanks in advance.
    Thankx & regards, Vipin jha MCP

    What happens if you hit Preview button in OLE DB Source Editor? Also you can use the same query by selecting SQL Command option and test.
    Could you try set the Delay Validation = True at Package and re-run ?
    If set the query in variable expression (not in value), then Set Evaluate As Expression = True.
    -Vaibhav Chaudhari

  • Creating a LOV by using a Command Object

    Hello All,
    I have a report that's driven by a parameterized sproc, which is a year parameter.  However, we have a table that I would like to use in my object command to populate this parameter with the values from the select statement to enforce consistency. A new year is inserted into to this table yearly by another process, which would keep me from having to go into a static list to update the year options yearly. 
    I've created the command object and saved it to the repository, but I can't figure out how to associate it to the report as the parameter.
    Can anyone point me in the right direction?
    Thanks in advance.

    hi DevinM,
    two choices:
    A) add the Command to your report
    1) you can add the Command to your report...don't link it to any tables though...you'll get a "Generally not supported error" but you can ignore it for this test
    2) now in your prompt you will have the Command available for the dynamic values
    3) check that the number of records on your report remains the same as before...it should...any test i have run on this is aok
    B) create a Business View
    1) go into the Business View Manager and create a business view from the data foundation up
    2) once you've got the business view built you can create an LOV from there which is available to your current report and all other reports
    jw

  • Problem creating a SQL command object and adding it to a Crystal report

    Hi,
    I'm trying to add the following SQL command object with the following sql for MYSQL 5.1
    SELECT lic.id, lic.productionname, comp.companyname, lic.paymentreceiveddate, lic.licenseissuedate,
    IFNULL((SELECT sum(licsong.feequoted) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfeequoted,
    IFNULL((SELECT sum(licsong.feetax) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfeetax,
    IFNULL((SELECT sum(licsong.feequoted + licsong.feetax) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfee,
    IFNULL((SELECT sum(pay.fullamount) from payment pay where pay.licenseid = lic.id),0) as totalpaid
    FROM license lic
    INNER JOIN company comp on lic.licensecompanyid= comp.id;
    This sql runs fine in the Query Browser of mysql and returns what I want.
    When I try to add this SQL command to a new Crystal Report, (by right clicking in the sql editor and selecting Crystal Reports - Add to new Crystal Report), it locks up my Eclipses and it ends up not responding. If I just do a simple SELECT * FROM license it works fine.
    The Eclipse I'm using is from the CR4E download page with the crystal plugin already installed.
    Any help with this would be greatful, as I am not having much joy with this CR4E 2.0 with MySQL and may have to scrap it and go back creating reports in Apache POI.
    Any help greatly received.
    Kind regards

    Hi,
    Try to select a particular columns instead of doing SELECT * FROM license.
    Thanks,
    Saravanakumar

  • Question re Command Object to populate parameter drop-down

    I have a report that uses a SQL Server stored procedure as the data source. The first parameter they enter is their company number (we have numerous clients using Lawson and access Crystal through LBI). The next parameter is the account number. I have a SQL statement written that gets distinct account numbers by company. When I create a Command object with the SQL statement, it doesn't allow me to use the company parameter.
    SELECT DISTINCT GLC.ACCOUNT, GLC.ACCOUNT_DESC
    FROM dbo.GLMASTER AS GLM
    INNER JOIN DBO.GLCHARTDTL AS GLC
    ON GLM.CHART_NAME = GLC.CHART_NAME
    AND GLM.ACCOUNT = GLC.ACCOUNT
    WHERE GLM.COMPANY = {?Company}
    ORDER BY GLC.ACCOUNT
    When I do Add Command in Database Expert and add the SQL above and name the parameter and try to Add, it says "Failed to retrieve data from the datase.
    Details: ADO Error Code: 0x
    Source: Microsoft OLE DB Provider for SQL Server
    Description: No value given for one or more required parameters
    Does anyone have a similar situation and a solution to this problem--either regarding my approach and error or a different approach to get the same thing?
    Any input would be greatly appreciated!

    You can't do this through a command object.  This particular type of parameter is called a "Cascading Dynamic Prompt".  You have to set these up through a Crystal Business View. 
    -Dell

  • Crystal Reports 2008 - passing a parameter in the Command Object

    Hi,
    I am using Crystal Reports 2008. I have 4 Command Objects where I have the following queries.
    select emrace, count(empl_id) cntFCiv  from emmain where emtype='CIV' and emsex ='F' and emdateterm is null group by emrace
    select emrace, count(empl_id) cntFSw  from emmain where emtype='SWOR' and emsex ='F' and emdateterm is null group by emrace
    select emrace, count(empl_id) cntMCiv from emmain where emtype='CIV' and emsex = 'M' and emdateterm is null  group by  emrace
    select emrace,count(empl_id) cntMSw from emmain where emtype='SWOR' and emsex = 'M' and emdateterm is null  group by emrace
    I want to pass a parameter  to all these command objects. I want the user to select a parameter from a list of values. So, I created a parameter object, Bureau. (I get the values for the parameter with this command object: select code_agcy, descriptn from systab1 where code_key = 'UNIT'). I want the user to be able to get the counts for each bureau.
    How do I pass the parameter that the user picked to those command objects. I tried doing this:
    select emrace, count(empl_id) cntFCiv  from emmain where emtype='CIV' and emsex ='F' and emdateterm is null
    and emunit = '{?Bureau}' group by emrace
    But it did not work. Any help will be greatly appreciated.
    Thanks.

    Hi,
    I am using Crystal Reports 2008. I have 4 Command Objects where I have the following queries.
    select emrace, count(empl_id) cntFCiv  from emmain where emtype='CIV' and emsex ='F' and emdateterm is null group by emrace
    select emrace, count(empl_id) cntFSw  from emmain where emtype='SWOR' and emsex ='F' and emdateterm is null group by emrace
    select emrace, count(empl_id) cntMCiv from emmain where emtype='CIV' and emsex = 'M' and emdateterm is null  group by  emrace
    select emrace,count(empl_id) cntMSw from emmain where emtype='SWOR' and emsex = 'M' and emdateterm is null  group by emrace
    I want to pass a parameter  to all these command objects. I want the user to select a parameter from a list of values. So, I created a parameter object, Bureau. (I get the values for the parameter with this command object: select code_agcy, descriptn from systab1 where code_key = 'UNIT'). I want the user to be able to get the counts for each bureau.
    How do I pass the parameter that the user picked to those command objects. I tried doing this:
    select emrace, count(empl_id) cntFCiv  from emmain where emtype='CIV' and emsex ='F' and emdateterm is null
    and emunit = '{?Bureau}' group by emrace
    But it did not work. Any help will be greatly appreciated.
    Thanks.

  • Using Crystal Reports formulas in Command Objects

    Post Author: Hamish
    CA Forum: Formula
    Is this possible?
    When I try and reference a formula in a command object
    something like
    select * from tablenamewhere id in (@testFormula)
    @testFormula prints out as 1,2 on the report if I remove the reference in the command object
    I get an error Incorrect syntax near @testFormula from SQL Server
    (I'm using CR XI and SQL Server 2005)

    Post Author: bryanflora
    CA Forum: Formula
    In a matter of fact, Formula is for you to calculate the result you get from DB.And if there's anything you want to pass to DB before you get result, it's Parameter.

  • SQL Command Object

    We are in the process of migrating reports from SSRS to Crystal 2011.
    In SSRS we are able to paste complex SQL into reports as the data source for the report (e.g. multiple CTE's, correlated subqueries, temp tables, etc).
    It appears that we can accomplish the same thing using Crystal command objects, but the reports created have to be distributed as stand-alone rpt files to customers. In that case the reports that use sql commands return an error that the command object does not exist. It seems the command object exists in the data connection (which is generated at run-time in the host application) and not in the rpt file itself.
    Is it possible to somehow use an sql query as the data source in the report in a manner that is independent of the data connection?
    Thanks

    Hi, 
    That's interesting, the query shouldn't be stored in the data connection.  It should be saved inside the rpt as part of the SQL Query. 
    How are you distributing the reports? 
    How is your application connecting the reports to the database? 
    As long as the reports logon to the tables and objects used in the SQL Command exist on the database it should run without a problem. 
    As a test, open the report in Crystal and go to Database | Show SQL Query.  You should see your SQL Command there.  Copy and paste the SQL into your production database and see if it runs. 
    Good luck,
    Brian

  • Multiple queries in single command object

    Hi All,
    My report uses a command object, which executes an insert query. I want to do 'collect' statistics after the insert query. How to do this in a single command object. Kindly suggest me the possibilities.
    Thanks in advance!
    Meena

    Ido, when I attempt to nest an insert statement followed by a select statement in the same command object, I get a "SQL Command not properly ended" error.
    Here is the SQL:
    insert into testing123 values (sysdate, 4)
    select * from testing123
    If use semicolons to separate the two statement, I get an "Invalid Character" error.
    Here is the SQL:
    insert into testing123 values (sysdate, 4);
    select * from testing123
    Any thoughts on what I might be doing wrong here?
    Thanks!
    Chad

Maybe you are looking for