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

Similar Messages

  • Changing Data Source for command objects

    Hi,
    My report (designed in CR 10) is running based on the Stored Procedure call using a command object; which is running successfully in the DEV environment. The report data source connectivity is a DSN.
    Now i want to switch it to QA environment with different DSN name. When i tried to update the Change Data Source option, it doesn't allows to update the existing command with a new command!!!!
    I don't know how to fix this. Could any one of you have idea, pls. share it here???
    Thanks
    Viswa

    If you have same table structure in new data source then you can change the datasource connection.
    Follow the steps in this article
    KBase Article ID:c2016958
    Article refers to:Crystal Reports 10
    Symptom
    In Crystal Reports (CR) 10, can you change the database connection of an existing command object to use a different database connection without the use of a Crystal Repository?
    Resolution
    Yes, you can change the database connection of an existing command object to use a different database connection without the use of a Crystal Repository by using the following steps:
    ====================
    NOTE:
    You must apply the CR 10 Monthly Hot Fix (cr10win_en.zip) and the CR 10 Database and Export Drivers Monthly Hot Fix (dbex10win_en.zip) before starting the steps below.
    You can download these hot fixes at http://support.businessobjects.com/search
    ====================
    1. Open a report with a command object.
    2. Go the 'Database' menu and click 'Set Datasource Location'.
    3. In the 'Set Datasource Location' dialog box, select the connection for the command object (the connection appears as a cylinder with a plug).
    4. In the lower window, select the new connection and log on to the database.
    5. Ensure the connection is highlighted for the command object in the top window, and the connection is highlighted for the new command object in the bottom window.
    6. Click Update.
    The database connection for the command object now changes to use the new database connection information.
    Regards,
    Raghavendra

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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.

  • Command On Source -Not Executing

    Hi
    In a CKM, I am creating a bind variable by ruuning the SQL on 'Command on Source' tab and using it as a bind variable in 'Command on Target' tab, but when I execute the interface I see only 'Command on Target' is getting executed and 'Command on Source' is not.
    I am getting a value in Command on Source tab and using it as a Table Name in the 'from' clause on the 'Command on Target'
    regards

    Any clue why Command on Source is not executing?

  • 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

  • Session facade vs Command object pattern

    Hello,
    I am debating using the Command pattern as my primary strategy for implementing my J2EE enterprise app business logic and would like some advice.
    The general idea is to have only a few types of abstract commands (such as a ReadComand, an UpdateCommand -- I might have a slightly finer granularity than this, I don't know) and implement each use case as a command instance. For example, I might have a command called GetOrderItemsCommand which is a ReadCommand and returns the list of order items (i.e., has a getItems() method) when execute()'d.
    The result of my design will be a very small set of stateless session beans with an execute() interface. No entity beans (will use Hibernate) and may very well eventually implement a Message bean interface with a similar executeAsynchronously() type method, if eventually necessary.
    I guess the popular alternative (or, more correctly, the norm) is to implement session facades for this.
    However, I am attracted to the Command pattern because of its simplicity, it's rapid application development angle, its disconnected-ness from EJB (e.g., a modification to a command does not mean touching any EJB at all, just the command class), and the ability for implementing cross-cutting features (such as transactions or security, although I also plan to use an AOP solution at the POJO level). At the same time, it works as a delegate of an EJB, so it's accessible for all kinds of network clients.
    I am also familiar with it's drawbacks (e.g., maintainability for large numbers of commands, per the literature, such as the Marinescu 2002 EJB Patterns book).
    So, very few types of stateless session beans (though there may be many instances) -- mainly there for remote client acceessibility and the ability to leverage application-level transactions if needed.
    Nevertheless, I have never tried the command pattern approach and was curious if others had feedback or case studies.
    Best regards --

    You normally use Command to decouple your controller from the view and model tiers. Your take on making command objects 'polymorphic' is interesting, and an angle I had not thought of. In general, I implement command objects rather like the Action class in Struts.
    Each command has implements an execute() method declared in the ICommad interface. The constructor of the command object ensures that a given command has all the variables and data required to execute properly. I also create a likes() method that returns a boolean. That way, I can add all my commands to a handler and iterate until on returns true on likes().
    - Saish

  • ODI Procedure (passing parameter from command on source to command on target) issue.

    Hi All,
    I am working on ODI 11.1.1.5.
    I am trying to run a select query on 'command on source' and tying to capture the output into command on target and execute the code captured.
    'command on source'
    select 'BEGIN ' || 'dbms_stats.gather_table_stats(ownname => ''' || pfg.table_owner || ''', tabname => ''' || pfg.table_name || '''' ||'END' ||';'  SQL_TEXT from TABLE_GROUP pfg , ALL_TABLES at
    where pfg.enabled = 'Y'     and   pfg.group_name = 'TABLE_NAME'     and   pfg.table_owner = at.owner     and   pfg.table_name  = at.table_name  (forgot abt the syntax, i have removed some part of the code to make it simple)
    the desired output will be:  (SQL_TEXT in the above code is to capture the output into it)
    BEGIN dbms_stats.gather_table_stats(ownname => 'OWNER_NAME', tabname =>  'TABLE_NAME', estimate_percent =>  DBMS_STATS.AUTO_SAMPLE_SIZE, degree =>  DBMS_STATS.DEFAULT_DEGREE); END;
    I am getting the desired result , the only problem is passing on this to 'command on target'. On "comm on target", I wanted to run this whole output (from BEGIN to END, as above) so I followed the below syntax/method of calling/executing this:
    :SQL_TEXT (did not work)
    #SQL_TEXT  (did not work)
    Any help on this is much appreciated. thanks in advance.
    Regard,Sp.

    It will not work like that. you have to either store the variable value in other variable and then use that.
    or
    write command on source like
    select pfg.table_owner SQL_TEXT1,pfg.table_name SQL_TEXT from TABLE_GROUP pfg , ALL_TABLES at
    where pfg.enabled = 'Y'     and   pfg.group_name = 'TABLE_NAME'     and   pfg.table_owner = at.owner     and   pfg.table_name  = at.table_name
    command on target/ technology --> oracle
    BEGIN
    dbms_stats.gather_table_stats(#SQL_TEXT1 || #SQL_TEXT)
    END
    I have not try out this before but i believe it will work.
    let me know
    Thanks

  • Command object help

    Hi All,
    I have a report having command object like this.My back end is MYSQL.
    I am not getting data in designer with below query
    SELECT * FROM clock_time WHERE STR_TO_DATE(DATE_FORMAT(clock_time,'%d-%m-%Y %H:%i'),'%d-%m-%Y %H:%i')= DATE_FORMAT('2014-06-19 11:03:43','%d-%m-%Y %H:%i')
    What is the mistake I am doing .
    Please help.

    Hi Divya,
    Does the same command work on the database when run via the database client?
    See if this works:
    SELECT * FROM clock_time WHERE DATE_FORMAT(clock_time,'%d-%m-%Y %H:%i') = Str_To_Date('19-06-2014 11:03','%d-%m-%Y %H:%i')
    -Abhilash

Maybe you are looking for

  • CLOB datatype appearing as UNDEFINED

    Hi, we are using Oracle 8.1.5 - if a table with column datatype CLOB is created - while describing the datatype appears as 'UNDEFINED'. Do I need to do any configuration? Has anyone come across this? thanks much, null

  • Galleries with passwords

    I have two galleries published. The first one allowed limit who can see the photos. I created a user name and no password. When I published the second gallery, I tried to limit who can see the photos, but each time I try to edit who can see the galle

  • Why can't I connect using face time

    Both myself and my sister have FaceTime enabled, and both have broadband, so why does it not connect, what have we missed, Doog.

  • Be Careful - HP may not stand behind your product purchase!

    I bought a DV 9500t laptop a few years ago for nearly $2700. The video card fried recently and upon looking into it, there are thousands of reports of a defective Nvidea card used in this unit. Nvidia has even acknowledged this. (There evidently is a

  • Creation of Purchase Requsition throgh Shoppin Cart

    Hi All,     My requirement is send the shopping cart details to correspondin two custom fields in ECC. For this I tried to implement the BADI "BBP_CREATE_BE_RQ_NEW" .But this BADI is not triggering while creating the shopping cart but corresponding P