How to crete CFL with SQL queries

Hi, First create the srf which has two buttons- Choose and Cancel code for creating the grid :- you have to pass the SQL query as a paramter in the below function .In query you choose as many as fields from the table ,at run time columns will automatically created corresponds to your query. private bool CreateGrid(string sSQL) { try { SAPbouiCOM.Item oItem; oItem = oform.Items.Add("Grid", SAPbouiCOM.BoFormItemTypes.it_GRID); oItem.Left = 7; oItem.Width = 387; oItem.Top = 47; oItem.Height = 188; oform.DataSources.DataTables.Add("dtLookUpTable"); oDataTable = oform.DataSources.DataTables.Item("dtLookUpTable"); oDataTable.Clear(); oDataTable.ExecuteQuery(sSQL); oGrid = (SAPbouiCOM.Grid)oItem.Specific; oGrid.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single ; oGrid.DataTable = oDataTable; if(oGrid.Rows.Count > 0) { oGrid.Rows.SelectedRows.Add(0); } for (int iColCounter = 0; iColCounter < oGrid.Columns.Count; iColCounter+) { oGrid.Columns.Item(iColCounter).Width = 50; oGrid.Columns.Item(iColCounter).Editable = false; } oGrid.AutoResizeColumns(); return true; } catch(Exception ex) { oform.Freeze(false); throw ex; } } -
choose the value on pressing the button 'Choose' protected override void ITEMPRESS_AFTERACTION(ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent, SAPbouiCOM.Application oSboApplication, SAPbobsCOM.Company oCompany) { BubbleEvent = true; if (pVal.ItemUID == "choosebuttonuid") { if (oGrid.Rows.SelectedRows.Count > 0) { SAPbouiCOM.DataTable oReturnTable = null; oform.DataSources.DataTables.Add("dtReturnTable"); oReturnTable = oform.DataSources.DataTables.Item("dtReturnTable"); oReturnTable.CopyFrom(oDataTable); for (int iRowIndex = 0; iRowIndex < oReturnTable.Rows.Count; iRowIndex) oReturnTable.Rows.Remove(iRowIndex); int iRow = oGrid.GetDataTableRowIndex(oGrid.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder)); oReturnTable.Rows.Add(1); //for (int iColIndex = 0; iColIndex < oReturnTable.Columns.Count; iColIndex+) // oReturnTable.SetValue(iColIndex, 0, oDataTable.GetValue(iColIndex, iRow)); oReturnTable.SetValue(0, 0, oDataTable.GetValue(0, iRow )); oReturnTable.SetValue(1, 0, oDataTable.GetValue(1, iRow)); SBOAppAddOn.mLookupForms.Remove(oform.UniqueID.ToString()); then u have to send the oReturnTable with parentuid( issue for production) to the baseform. example-> SendData(oReturnTable, strParentFormUID, oSboApplication, oCompany); oform.Close(); } } } More:- You have to include the Doubleclick faclity on the grid You have to include the find functionality also.

Hi,
Can u repost?? as its very difficult to understand ur problem.
Vasu Natari.

Similar Messages

  • Generate ER Diagram with Sql Queries ?

    Hi Expertie,
    I am new to Oracle Sql Developer Data Modeler.
    I am having doubt in Oracle Sql Developer Data Modeler. Can we create ER Diagram with sql queries ?
    Ex: select Ename, EAge, Eemail, ESalary, DDept, Dname, Estatus from Emp E join Dept D on E.EmpId = D.Empid
          Where EAge in (20, 25, 30, 35)
    Please provide me the answer and suggestion. It will be greatful for me.
    Thanks & Regards
    Bhaskar

    Yes, you can engineer your physical model to a logical one, then you'll have an ERD as well. It's a right-click on the model I believe.
    To be more specific, if you relational model is loaded, you can use the button in the toolbar that looks like a double-blue-arrow, or you can mouse-right-click on your relational model in the tree. This will engineer your model to a logical one. You'll then have your ERD.
    Edited by: Jeff Smith SQLDev PM on Apr 29, 2013 9:53 AM

  • Links with sql queries to practice

    Hi all,
    Can someone give me the links with sql queries for practice to preparing for OCP
    Thanks
    Shekar.

    Hi,
    Can u repost?? as its very difficult to understand ur problem.
    Vasu Natari.

  • How to do it with SQL Loader

    All,
    I have two tables HEADER_TABLE and LINE_TABLE. Each header record can have multiple line records. I have to load data from a flat file to these tables.Flat file can have two types of records. H-Header, L-Line. It looks as follows.. Each H record can have multiple corresponding L records
    H..........
    L.......
    L......
    L......
    H.........
    L.......
    L......
    L......
    I have HEADER_ID column in HEADER_TABLE and HEADER_ID, LINE_ID columns in the LINE_TABLE.
    While loading data using SQL Loader, I need to generate HEADER_ID and LINE_ID values as follows and load them.
    H..........<HEADER_ID = 1>
    L....... <HEADER_ID = 1><LINE_ID = 1>
    L...... <HEADER_ID = 1><LINE_ID = 2>
    L...... <HEADER_ID = 1><LINE_ID = 3>
    H......... <HEADER_ID = 2>
    L....... <HEADER_ID = 2><LINE_ID = 4>
    L...... <HEADER_ID = 2><LINE_ID = 5>
    L...... <HEADER_ID = 2><LINE_ID = 6>
    Is it possible to do this with SQL LODER?
    I tried to do this with sequences. But it loaded the tables as follows.
    H..........<HEADER_ID = 1>
    L....... <HEADER_ID = 1><LINE_ID = 1>
    L...... <HEADER_ID = 1><LINE_ID = 2>
    L...... <HEADER_ID = 1><LINE_ID = 3>
    H......... <HEADER_ID = 2>
    L....... <HEADER_ID = 1><LINE_ID = 4>
    L...... <HEADER_ID = 1><LINE_ID = 5>
    L...... <HEADER_ID = 1><LINE_ID = 6>
    Thanks
    Ketha

    Morgan,
    Examples given in the link are quite generic and I have tried them. But my requirement is focused on generating header_id and line_id values as i have described. It seems that SQLLDR scans all records for a particular WHEN clause and insert them into the specified table. I think that if SQLLDR is made to read recod in the data file sequentially, this can be done.
    ANy idea of how to make SQLLDR read the records from the file sequentially?
    Thanks
    Ketha

  • Looking for a SQL report guru to help me with SQL queries

    As an independent consultant, I sometimes need to build custom SSRS reports.  I need someone I can reach out to when SQL queries become complex.  There is such a query now.
    Thanks.
    Richgar
    612-207-8347

    Thanks, Visakh,
    I'm trying to determine which resources did not fill out a timesheet.  The result of this query is missing just a few names and I can't find the reason.  I'm thinking of a web meeting looking at real data is necessary and will be glad to pay
    for the help.
    SELECT       
    ResourceName, ResourceIsGeneric, ResourceType, RBS, ResourceIsActive
    FROM           
    MSP_EpmResource_UserView
    WHERE       
    (ResourceName NOT IN
    (SELECT DISTINCT MSP_EpmResource_UserView_1.ResourceName
    FROM           
    MSP_EpmResource_UserView AS MSP_EpmResource_UserView_1 INNER JOIN
    MSP_TimesheetLine_UserView ON MSP_EpmResource_UserView_1.ResourceUID = MSP_TimesheetLine_UserView.ResourceUID INNER JOIN
    MSP_Timesheet ON MSP_TimesheetLine_UserView.TimesheetUID = MSP_Timesheet.TimesheetUID
    WHERE        (MSP_EpmResource_UserView_1.ResourceType = 2) AND (MSP_EpmResource_UserView_1.ResourceIsActive = 1) AND (MSP_EpmResource_UserView_1.RBS IS NOT NULL) AND
    (CONVERT(varchar, MSP_TimesheetLine_UserView.PeriodStartDate, 101) IN (@Period_Start_Date)) AND (MSP_EpmResource_UserView_1.RBS IN (@RBS)))) AND (ResourceIsGeneric = 0) AND
    (ResourceType = 2) AND (RBS IN (@RBS)) AND (ResourceIsActive = 1)

  • How to group data from SQL queries in XMLP Enterprise Edition

    Hi all,
    I have installed XMLP EE on a windows machine. I tried creating the data set with the type as SQL Query. In my case I have just joined the EMP and DEPT tables from the SCOTT schema:
    select     EMP.EMPNO as EMPNO,
         EMP.ENAME as ENAME,
         EMP.JOB as JOB,
         DEPT.DNAME as DNAME,
         EMP.DEPTNO as DEPTNO
    from     SCOTT.EMP EMP,
         SCOTT.DEPT DEPT
    where DEPT.DEPTNO=EMP.DEPTNO
    and DEPT.DNAME = nvl(:DeptName,DEPT.DNAME )
    I want that the data should be displayed in my report so that for each value of DNAME all the details (EMP.EMPNO, EMP.ENAME, EMP.JOB ) should be displayed as in master detail format in my XML output, so that it is easier to build the template using the <?for-each?> tags.
    Can anyone suggest how I can do this?
    I am facing another error :
    The report cannot be rendered because of an error, please contact the administrator.
    Can anyone help me with this too?
    Thanks.

    Hi
    On the error, have you tried running the report to generate data only ? If that is failing then you have an issue with your query or connection
    On the grouping, hopefully you have the Template Builder installed. That can help you build the grouping you want in the output. For this report and to get you started check out the Table Wizard. There is a screen in that flow allowing you to specify Grouping criteria.
    the following blog article may help too:
    http://blogs.oracle.com/xmlpublisher/2007/05/03#a265
    and this getting started with templates doc
    http://www.oracle.com/technology/products/xml-publisher/xmlpclient.html
    Regards
    Tim

  • How to set hint with SQL profile

    Hi,
    I need to put a leading hint into a sub-query
    How can I do that ?
    I tried:
    dbms_sqltune.import_sql_profile
    sql_text => 'select ...'
    profile => sqlprof_attr(XXXXX) => I don't know what to set for XXXXX
    name => my_sql_profile
    force_match => true)10.2.0.4
    Thanks for your help

    I need to put a leading hint into a sub-query It doesn't sound like a good idea.
    If you're going to hint - especially using plan stability features - then you need to hint fully otherwise you're asking for trouble.
    See http://jonathanlewis.wordpress.com/2011/06/08/how-to-hint-1/
    The "best" approach to this sort of generic question is to run the sql statement with the single leading hint (if that really is desirable) then extract the full set of hints from that execution (which will have a different sql id) and apply it to your original statement.
    If you have a look at COE_XFR_SQL_PROFILE.SQL in Oracle Support doc id 215187.1 then that will give you a good idea of how to do it.
    That script is not exactly what you want because it uses a sql profile to apply a previously generated plan for that specific sql taken out of AWR or the cursor cache, but the principle is the same.
    This is using SQL Profiles as they were not originally designed - which was vehicles for statistical adjustements - but using them like stored outlines (the latter deprecated in 11.1 onwards).
    SQL Profiles require the tuning pack.
    You have not mentioned version but depending on that, it might be that SQL Plan Baselines are the appropriate mechanism and you can achieve something similar to that mentioned above using dbms_spm.load_plans_from_cursor_cache:
    load_plans_from_cursor_cache 
    (sql_id           IN VARCHAR2,   <---------- the sql id of the manually hinted sql from which to copy the plan
    plan_hash_value  IN NUMBER := NULL,  <-------------- the plan in memory to copy
    sql_text         IN CLOB,  <-------------------- the sql text of the sql to apply the plan above to (get via a direct look up from v$sql or dba_hist_sqltext as necesary)
    fixed            IN VARCHAR2 := 'NO', 
    enabled          IN VARCHAR2 := 'YES') Whichever method you use, avoid any sort of solution involving a single hint directed at a subquery.
    Edited by: Dom Brooks on Nov 26, 2012 9:48 PM
    reworded

  • Help with SQL queries following migration

    Hi there,
    I have just migrated from MS SQL Server database to Oracle 10g database using the Oracle SQL Developer.
    My application is using JDBC to access the database, and there are heaps of SQL statements that need to be verified and tested. I've found a number of SQL compatibility issues from my testing of the Oracle database and I hope you can help me the following.
    1. Case sensitivity
    Is it possible to not enforce case sensitivity (by default) when performing a select query?
    If this is not possible, all the SQL statements will need to be changed to evaluate column based on uppercase.
    2. Trailing white space
    Is it possible to not evaluate trailing white space (by default) when performing a select query?
    For example, suppose a table column studentNo has trailing spaces (after database migration), e.g. 'A182D '
    when performing query - select * from student where studentNo = 'A182D'
    no results can be found
    3. Issue with Where condition containing with '' = ''
    There are quite a number of SQL statements with Where condition containing '' = ''.
    For example, the following SQL query doesn't return any results even though there are matching suburb that starts with 'ST'. These types of queries are mostly used in dynamic generated queries.
    select * from Address where (suburb like 'ST%') and ('' = '' or country = '')
    Any help or advice will be greatly appreciated.
    Regards,
    Jason Gordon

    As justin mentioned setting those NLS parameters will make oracle not to use your regular index. for that you must create a function based index. See example below.
    SQL> create index t_idx on t (name)
      2  /
    Index created.
    SQL> exec dbms_stats.gather_table_stats(user,'T',cascade=>true)
    PL/SQL procedure successfully completed.
    SQL> explain plan for
      2  select * from t where name = 'karthick'
      3  /
    Explained.
    SQL> select * from table(dbms_xplan.display)
      2  /
    PLAN_TABLE_OUTPUT
    Plan hash value: 2946670127
    | Id  | Operation        | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT |       |     1 |     9 |     1   (0)| 00:00:01 |
    |*  1 |  INDEX RANGE SCAN| T_IDX |     1 |     9 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - access("NAME"='karthick')
    13 rows selected.
    SQL> delete from plan_table
      2  /
    2 rows deleted.
    SQL> alter session set NLS_COMP=ANSI;
    Session altered.
    SQL> alter session set NLS_SORT=BINARY_CI;
    Session altered.
    SQL> explain plan for
      2  select * from t where name = 'karthick'
      3  /
    Explained.
    SQL> select * from table(dbms_xplan.display)
      2  /
    PLAN_TABLE_OUTPUT
    Plan hash value: 1601196873
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |     9 |     5   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| T    |     1 |     9 |     5   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - filter(NLSSORT("NAME",'nls_sort=''BINARY_CI''')=HEXTORAW('6B61727
                  46869636B00') )
    14 rows selected.
    SQL> create index t_idx_1 on t(NLSSORT(name,'NLS_SORT=BINARY_CI'))
      2  /
    Index created.
    SQL> exec dbms_stats.gather_table_stats(user,'T',cascade=>true)
    PL/SQL procedure successfully completed.
    SQL> /
    create index t_idx_1 on t(NLSSORT(name,'NLS_SORT=BINARY_CI'))
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    SQL> delete from plan_table
      2  /
    2 rows deleted.
    SQL> explain plan for
      2  select * from t where name = 'karthick'
      3  /
    Explained.
    SQL> select * from table(dbms_xplan.display)
      2  /
    PLAN_TABLE_OUTPUT
    Plan hash value: 2580036035
    | Id  | Operation                   | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |         |     3 |    27 |     2   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T       |     3 |    27 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | T_IDX_1 |     3 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access(NLSSORT("NAME",'nls_sort=''BINARY_CI''')=HEXTORAW('6B6172746869636B00') )Thanks,
    Karthick.

  • How to Load Data with SQl Loader to a Form (D2k,VB,Applet.Etc.,)

    hi.,
    By SQL LOADER iam able to Transfer data to Oracle Database, from a Flat File System.
    But now i want to Transfter the data from Flat Files, to Oracle Apps/VB/D2k Etc.,
    with help of SQL Loader.,
    is it possible to do..?
    Thanks in Advance,
    With Regards.,
    N.GowriShankar.

    For the Applications you can use file handling built-ins such as TEXT_IO, UTL_FILE, etc. You can write a batch program for sqlldr and can invoke it from front end Applications.

  • How to use PHP with SQL?

    how to use sql in php and output a new ERP table contains every order_number, every order_quantity and so on then ouput sum of company and then sum of area
    and so on.
    now i only know a little how to use sql in php and you can give some examples of this?

    This sounds like a nice little homework exercise.
    Check the PHP FAQs for Oracle/PHP help
    http://www.oracle.com/technology/tech/php/htdocs/php_faq.html
    http://www.oracle.com/technology/tech/php/htdocs/php_troubleshooting_faq.html
    For SQL help, check http://asktom.oracle.com/
    -- cj

  • ASSERTION_FAILED when filling dropdownbykey with sql queries

    Hi everybody,
    I'm new to WDA, and I am coding a new interface for transaction CBIH82 in EHS.
    I am filling a dropdownbykey with a sql query, for the work area.
    On the view, the dropdownbykey is populated, but when I click on a button, or when I launch an action, I have the error "ASSERTION_FAILED".
    However, if I fill the dropdownbykey manually in the code, I got no error.
    Error in IE :
    The ASSERT condition was violated
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: CONV_VIEW_INTO_VE_ADAPTER_TREE of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP
    Method: SET_CONTENT_BY_WINDOW of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP
    Method: RENDER_WINDOWS of program CL_WDR_CLIENT_SSR=============CP
    Method: IF_WDR_RESPONSE_RENDERER~RENDER_VIEWS of program CL_WDR_CLIENT_SSR=============CP
    Method: IF_WDR_RESPONSE_RENDERER~RENDER_USER_INTERFACE_UPDATES of program CL_WDR_CLIENT_SSR=============CP
    Here is the dump :
    27926     else.                                                                           
    27927       IFUR_NW5_COMBOBOX~READONLY = wd_DROPDOWN_BY_KEY->vl_READ_ONLY.                
    27928     endif.                                                                          
    27929 *   >> UCA STANDARD|ABSTR_DROPDOWN_BY_KEY|READONLY                                  
    27930     if M_PARENT_READONLY = abap_true or                                             
    27931        mv_KEY_ATTR_INFO-is_read_only = abap_true.                                   
    27932       IFUR_NW5_COMBOBOX~READONLY = abap_true.                                       
    27933     endif.                                                                          
    27934                                                                               
    27935 *   >> property-UCA IFUR_NW5_COMBOBOX~REQUIRED                                      
    27936 *   >> UCA STANDARD|DROPDOWN_BY_KEY|REQUIRED                                        
    27937     if mv_WD_STATE = cl_wd_dropdown_by_idx=>e_state-required.                       
    27938       IFUR_NW5_COMBOBOX~REQUIRED = abap_true.                                       
    27939     else.                                                                           
    27940       IFUR_NW5_COMBOBOX~REQUIRED = abap_false.                                      
    27941     endif.                                                                          
    27942                                                                               
    27943 *   >> property-Property IFUR_NW5_COMBOBOX~USEDINSAPTABLE                           
    27944     IFUR_NW5_COMBOBOX~USEDINSAPTABLE = /1WDA/VTABLE_CELL_EDITOR~mv_INSIDE_TABLE.    
    27945                                                                               
    27946 *   >> property-UCA mv_VALUE_SET                                                    
    27947 *   >> UCA STANDARD|ABSTR_DROPDOWN_BY_KEY|VALUE_SET                                 
    27948     data value_set_item type WDR_CONTEXT_ATTR_VALUE.        "#EC NEEDED             
    27949     mv_VALUE_SET = mv_KEY_ATTR_INFO-value_set.                                      
    27950     read table mv_VALUE_SET into value_set_item                                     
    27951       with key value = mv_KEY_INTERNAL.                                             
    27952     if sy-subrc = 0.                                                                
    27953       IFUR_NW5_COMBOBOX~VALUE = cl_http_utility=>escape_html( value_set_item-text ).
    27954     else.                                                                           
    27955       " entry not found - only legal for "initial" value                            
    >>>>>       assert mv_KEY_INTERNAL co ` 0`.                       "#EC NOTEXT             
    27957       IFUR_NW5_COMBOBOX~VALUE = ''.                         "#EC NOTEXT             
    27958     endif.                   
    The error is at line 27956.                                                     
    And here is my code to fill the dropdownbykey in my wddoinit of my view :
    data:
        lieux_de_travail                    type string,
        description_lieux_travail           type string,
        table_record_number_travail         type TABLE OF string,
        table_lieux_travail_full            type TABLE OF string,
        lieux_travail_full                  type string,
        record_number_travail               type string,
        valeur_int                          type i VALUE 0,
        valeur_string                       type string.
    SELECT RECNROOT FROM CCIHT_WAH INTO TABLE table_record_number_travail.
    LOOP AT table_record_number_travail INTO record_number_travail.
      SELECT WANAM FROM CCIHT_WALD INTO description_lieux_travail WHERE RECNROOT = record_number_travail.
      ENDSELECT.
      SELECT WAID FROM CCIHT_WAH INTO lieux_de_travail WHERE RECNROOT = record_number_travail.
      ENDSELECT.
      IF NOT lieux_de_travail = 'ALOUETTE'.
        CONCATENATE lieux_de_travail description_lieux_travail INTO lieux_travail_full SEPARATED BY ' - '.
      ELSE.
        lieux_travail_full = lieux_de_travail.
      ENDIF.
    INSERT lieux_travail_full INTO TABLE table_lieux_travail_full.
    ENDLOOP.
    data:     NODE_INFO type ref to IF_WD_CONTEXT_NODE_INFO,
              NODE_INFO_ACLOC type ref to IF_WD_CONTEXT_NODE_INFO.
    NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ).
    NODE_INFO_ACLOC = NODE_INFO->GET_CHILD_NODE( 'INFO_ACLOC' ).
    data:    LT_VALUESET type WDR_CONTEXT_ATTR_VALUE_LIST,
             L_VALUE type WDR_CONTEXT_ATTR_VALUE.
    valeur_int = 0.
    LOOP AT table_lieux_travail_full INTO L_VALUE-TEXT.
      ADD 1 TO valeur_int.
      MOVE valeur_int to valeur_string.
      L_VALUE-VALUE = valeur_string.
      INSERT L_VALUE into table LT_VALUESET.
    ENDLOOP.
    CLEAR valeur_int.
    NODE_INFO_ACLOC->SET_ATTRIBUTE_VALUE_SET(
         NAME = 'LIEUX'
         VALUE_SET = LT_VALUESET ).
    The values are stored in the context node "INFO_ACLOC", and cardinality 1.1/0.1, in LIEUX of type String.
    Anybody had this error before?
    Thank you!
    Brad

    Hi Thomas,
    thank you, that was it.
    I had a conversion of int to string, and the resulting string was not good.
    It looked like as a number in the debug mode, but not in the hexadecimal value.
    I did not saw it, because I'm beginning to learn abap too.
    Brad

  • Can I get metadata with SQL queries ??

    Can I get relationships between tables in MS Access using SQL statements ??

    Actually, you might be able to get what you need out of DatabaseMetaData class.
    DatabaseMetaData meta = connection.getMetaData();perhaps using:
    public ResultSet getCrossReference(String primaryCatalog,
                                       String primarySchema,
                                       String primaryTable,
                                       String foreignCatalog,
                                       String foreignSchema,
                                       String foreignTable)
                                throws SQLException
    Retrieves a description of the foreign key columns in the given foreign key table that reference the primary key columns of the given primary key table (describe how one table imports another's key). This should normally return a single foreign key/primary key pair because most tables import a foreign key from a table only once. They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ.

  • JComboBox or JList with SQL queries. Best practises.

    Hi!
    I'm wondering what you do in the following situation, providing you develop a hotel reservation application and you have a form where you enter room details: room number, number of rooms, description and type (JComboBox).
    So when executing an INSERT query what do you usually do? Do you store ID's of types or execute addtion SELECT query to get the if of the selected type?

    Thank you very much! I like your approach, but what if I should fill in a form automatically? I mean I have a section in my application where you can edit rooms, you choose a room from a JList and fter clicking on a particular room, the fields of the form get entered and if I have a JComboBox there what should I do?
    I use this approach:
    <code>
    public void valueChanged ( ListSelectionEvent e )
    Item item = ( Item ) lRooms.getSelectedValue();
    try {
    Db db = new Db ();
    ResultSet rs = db.executeQuery ( "SELECT * FROM rooms " +
    "WHERE id = " + item.getId () );
    rs.next ();
    pRoomsEdit.this.id = rs.getInt ( "id" );
    tfNo.setText ( item.getName () );
    ComboBoxModel cbm = cbType.getModel ();
    ResultSet rsType = db.executeQuery ( "SELECT name FROM types " +
    "WHERE id = " + rs.getString ( "type" ) );
    rsType.next ();
    cbm.setSelectedItem ( new Item ( rs.getInt ( "id" ), rsType.getString ( "name" ) ) );
    tfRoomNum.setText ( rs.getString ( "roomNum" ) );
    taDesc.setText ( rs.getString ( "description" ) );
    catch ( SQLException se ) {
    se.printStackTrace ();
    </code>

  • SQL Queries, filter with multiple radio Buttons

    I am trying to figure out how to filter my datagridview with SQL queries so that both of them have to be met for data to show up not just one.
    My datagridview is bound to an Access Database.
    I basically would want it filtered by 'Width' and 'Wood Type'
    I have radio buttons in group boxes so a width and wood can be selected. However only one Query is applied at a time.

    Public Class Form1
    Private Sub StickersBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)
    Me.Validate()
    Me.StickersBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.TestDataSet)
    End Sub
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'TestDataSet.Stickers' table. You can move, or remove it, as needed.
    Me.StickersTableAdapter.Fill(Me.TestDataSet.Stickers)
    AcceptButton = Button1
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    End Sub
    Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
    Try
    Me.StickersTableAdapter.Wood_Oak(Me.TestDataSet.Stickers)
    Catch ex As System.Exception
    System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try
    End Sub
    Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton2.CheckedChanged
    Try
    Me.StickersTableAdapter.Wood_Walnut(Me.TestDataSet.Stickers)
    Catch ex As System.Exception
    System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try
    End Sub
    Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton3.CheckedChanged
    Try
    Me.StickersTableAdapter.Width14(Me.TestDataSet.Stickers)
    Catch ex As System.Exception
    System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try
    End Sub
    Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton4.CheckedChanged
    Try
    Me.StickersTableAdapter.Width18(Me.TestDataSet.Stickers)
    Catch ex As System.Exception
    System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try
    End Sub
    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
    If RadioButton5.Checked = True Then
    If TextBox1.Text = "" Then
    Else
    Me.StickersBindingSource.Filter = "Width LIKE '" & TextBox1.Text & "%'"
    DataGridView1.Refresh()
    End If
    ElseIf RadioButton6.Checked = True Then
    If TextBox1.Text = "" Then
    Else
    Me.StickersBindingSource.Filter = "[Wood Type] LIKE '" & TextBox1.Text & "%'"
    DataGridView1.Refresh()
    End If
    ElseIf RadioButton5.Checked = False And RadioButton6.Checked = False Then
    MsgBox("Please Select a Search Criteria")
    End If
    End Sub
    Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
    Try
    Me.StickersTableAdapter.SearchWood(Me.TestDataSet.Stickers)
    Catch ex As System.Exception
    System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try
    End Sub
    End Class

  • Recursive Java programming method for executing recursive SQL queries

    Anybody has a Java/JDBC example method to execute recursive SQL queries and print results? The method has to work for any number of queries and levels and the first query passes the parameter to the second query.
    Edited by: user4316962 on Jun 12, 2011 1:59 PM

    user4316962 wrote:
    Guys, the problem what I am trying to solve is much more complex and I don’t think SQL level recursion is enough. I am looking for Java solution with SQL queries in it to make it more flexible and DB independent.
    If you want to do recursion in SQL then it has nothing to do with Java.
    And if you want to do recursion in Java then the idiom itself has nothing to do with SQL.
    Other than that you have provided enough detail for anyone to even guess at what you are asking.
    As a start I am not even sure that you understand what recursion is nor how JDBC works. (But it could be that you are using the terms to mean something else.)
    And looking at your original post it could be nothing more than that you are looking for a design pattern - perhaps the interpreter.

Maybe you are looking for

  • My iPod Touch 16GB won't charge up more than 50%!?

    Well I just bought my iPod Touch 16GB this past Sunday at a Best Buy here in Austin Texas and everything seems to work fine for me EXCEPT I cannot charge the device more than 50%. The battery icon will show up but will never show more than a 50% char

  • How can I call a servlet method from a javascript function

    I want to call l a servlet method from a javascript function. Does any one have an example of code. Thinks in advance

  • How to create a table with rows within a row?

    Hi, I am trying to create a table that looks like this: https://acrobat.com/#d=XyI3rlSWMWYXQixzpRSrXA but I can't figure it out. Please can someone tell how I should go about this? thanks for the help.

  • Standard report output to be saved in application server

    Hi All,     My requirement is to create a program which can save the standard report otuput(The output of the tcode S_ALR_87012936)  to the application server.Please help. Thanks and Regards, Kowsalya.

  • Case condition in where clause

    Hi I'm a SQL beginner but according to my reading of the manual, this syntax should be acceptable. I'm using it in application express but tested it also in SQL developer and finding that it fails with an "invalid relational operator" error, with the