HOw to compare column with column using JCheckBox

i have declare 4 JCheckBox which is a,b,c,d
How to compare this value with the one in the database?

Hi
Say myCheckbox is the checkbox I want to test.
The example below uses its state to query the database:
String value;
Statement stmt;
ResultSet rset;
value = myCheckbox.isSelected() ? "Y" : "N";
stmt = conn.createStatement();
rset = stmt.executeQuery("select column2 from table where column2 = "+value);
In this case, the database colum is character, with the possibles values of Y or N.
hth
Luis Cabral

Similar Messages

  • How to export data with column headers in sql server 2008 with bcp command?

    Hi all,
    I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
    am trying to import data with bcp command data has been copied but column names are not came.
    I am using the below query:-
    EXEC master..xp_cmdshell
    'BCP "SELECT  * FROM   [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
    Thanks,
    SAAD.

    Hi All,
    I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
    DECLARE @BCPCMD
    nvarchar(4000)
    DECLARE @BCPCMD1
    nvarchar(4000)
    DECLARE @BCPCMD2
    nvarchar(4000)
    DECLARE @SQLEXPRESS
    varchar(50)
    DECLARE @filepath
    nvarchar(150),@SQLServer
    varchar(50)
    SET @filepath
    = N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
    as varchar(4))
    +RIGHT('00'+CAST(MONTH(GETDATE())
    as varchar(2)),2)
    +RIGHT('00'+CAST(DAY(GETDATE())
    as varchar(2)),2)+'.log" '
    Set @SQLServer
    =(SELECT
    @@SERVERNAME)
    SELECT @BCPCMD1
    = '''BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT '
    SELECT @BCPCMD2
    = '-c -t , -T -S '
    + @SQLServer + 
    SET @BCPCMD
    = @BCPCMD1+ @filepath 
    + @BCPCMD2
    Print @BCPCMD
    -- Print out below
    'BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
    EXEC
    master..xp_cmdshell
    @BCPCMD
      ''BCP' is not recognized as an internal or external command,
    operable program or batch file.
    NULL
    if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
    EXEC
    master..xp_cmdshell
    'BCP "SELECT  * FROM  
    [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
    Thanks, SAAD.

  • How Achieve timedseries calculations with out using AGO And ToDate function

    Hi,,
    1)
    How Achieve timedseries calculations with out using AGO And ToDate functionion
    this question asking in interview ..is it possible..?
    if yes please response as soon as possible..
    2) i have 2 cloumns Product and value...
    client requirement is they need ranks based on Value ..in dashboard .using dashboard prompt..edit box...if user enter any number (ex :5 ) report should show top 5 ranks if he enter 20 should be top 20 ranks..
    how to achive this ?
    thanks,
    raj

    Consider yor first question:
    1. Yes, we can create timeseries measures without using AGO and TODATE
    1. Create ALIAS of fact tabe in the physical layer
    2. Join the Time id from the ALIAS fact table with the YAGO_MONTH_ID column from your time dimension table (For calculating Year Ago variants) similarly join with MAGO_MONTH_ID column for Month Ago measures.
    3.Pull the ALIAS tables as an additional Logical table source in the Lgical layer
    4.Keep the mapping of the columns from the ALIAS table as its is
    5. For e.g If you pick Revenue from the Year Ago Alias table it will give you the "Prior Year Revenue"
    See if this helps you

  • How can I scan with mavericks using Epsom printer

    How can I scan with mavericks using Epsom printer

    Some users have had success using Image Capture in the Applications folder - although it doesn't seem to work for everybody. Worth a try.

  • How to compare varchar with number

    i am doing one report for that am passing receipt number(from , to) as parameters
    if i compare for that table i am getting output.
    select receipt_num from rcv_shipment_headers rsh
    where to_number(rsh.receipt_num) between nvl(:P_RECEIPT_FROM,rsh.receipt_num) and nvl(:P_RECEIPT_TO,rsh.receipt_num)
    but when i am using in below query it is getting error "Invalid Number"
    select rsh.receipt_num
    , sum(rs.quantity)
    , rs.unit_of_measure
    , rct.transaction_date "Date of Entry"
    , pov.vendor_name
    , msi.segment1 "Item Code"
    , msi.description "Item Description"
    from rcv_transactions rct
    , rcv_shipment_headers rsh
    , rcv_shipment_lines rsl
    , po_vendors pov
    , mtl_system_items_b msi
    , rcv_supply rs
    where rsh.shipment_header_id=rct.shipment_header_id
    and rsh.shipment_header_id=rsl.shipment_header_id
    and rsl.shipment_line_id=rct.shipment_line_id
    and rsh.vendor_id=pov.vendor_id
    and rsl.item_id=msi.inventory_item_id
    and msi.organization_id=106
    and rsl.shipment_line_id=rct.shipment_line_id
    and rct.transaction_id=rs.rcv_transaction_id
    and to_number(rsh.receipt_num) between nvl(:P_RECEIPT_FROM,rsh.receipt_num) and nvl(:P_RECEIPT_TO,rsh.receipt_num)
    and rct.organization_id=nvl(:P_ORG_ID,rct.organization_id)
    and rsh.vendor_id=nvl(:P_Vendor_Name,rsh.vendor_id)
    and rct.inspection_status_code='NOT INSPECTED'
    group by rsh.receipt_num
    , rs.unit_of_measure
    , rct.transaction_date
    , pov.vendor_name
    , msi.segment1
    , msi.description
    plese help to solve
    Thanks & Regards
    Adina

    The problem lies here:
    and rsh.vendor_id=nvl(:P_Vendor_Name,rsh.vendor_id)How can you compare vendor_name with vendor_id????????????
    SQL> select * from po_vendors where vendor_id = NVL(&p_vendor_name,vendor_id);
    Enter value for p_vendor_name: 'AAAA'
    old   1: select * from po_vendors where vendor_id = NVL(&p_vendor_name,vendor_id)
    new   1: select * from po_vendors where vendor_id = NVL('AAAA',vendor_id)
    select * from po_vendors where vendor_id = NVL('AAAA',vendor_id)
    ERROR at line 1:
    ORA-01722: invalid number
    SQL> Message was edited by:
    user605919

  • How to Compare date with Current system date in XSLT mapping.

    Hello Experts
    In a XSLT mapping program, I hava a filed, ZZOB which is giving some date.
    which I need to compare with the current date.
    Condition-
    ZZOB is greater than current date or ZZOBLIG = NULL
    Then go further statements.
    how can i campare with the current date?
    Please help.
    Thanks
    Balaprasad

    This example may help:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:param name="currentDate"/>
        <xsl:variable name="firstDate" select="concat(substring($currentDate, 1,4),substring($currentDate, 6,2),substring($currentDate, 9,2))"/>
        <xsl:template match="/">
            <xsl:apply-templates select="//item"/>
        </xsl:template>
        <xsl:template match="item">
            <xsl:variable name="secondDate" select="concat(substring(submissionDeadline, 1,4),substring(submissionDeadline, 6,2),substring(submissionDeadline, 9,2))"/>
            <xsl:choose>
            <xsl:when test="$firstDate &gt; $secondDate">
                <xsl:call-template name="late"/>
                </xsl:when>
                <xsl:when test="$firstDate &lt; $secondDate">
                    <xsl:call-template name="ontime"/>
                </xsl:when>
                <xsl:when test="$firstDate = $secondDate">
                    <xsl:call-template name="same"/>
                </xsl:when>
                <xsl:otherwise>Monkeys<br /></xsl:otherwise>
            </xsl:choose>
        </xsl:template>
        <xsl:template name="ontime">
            This is on time
        </xsl:template>
        <xsl:template name="late">
            This is late
        </xsl:template>
        <xsl:template name="same">
            This is on time
        </xsl:template>
    </xsl:stylesheet>

  • How to Integrate XI with Peoplesoft using iWay Adapter

    hi Friends,
            This is Sreeni. I want to use iWay adapter for integrate Peoplesoft with XI.
    can you please help me in this way.

    Hi,
    There is a series of blogs that address this same area. Please look into them. they should surely help,
    /people/yomeshp.sharma/blog/2006/06/01/integrating-jdedwards-system-with-xi-using-iway-adapter-part--i - Part I
    /people/yomeshp.sharma/blog/2006/06/01/integrating-jdedwards-system-with-xi-using-iway-adapter-part--ii - Part II
    /people/yomeshp.sharma/blog/2006/05/31/integrating-jdedwards-system-with-xi-using-iway-adapter-part--iii - Part III
    Regards
    Bhavesh

  • How to compare 2 different columns

    Hi experts,
    I have a report with the following structure:
    account ---- booking account----- D/C------ balance
    ac1-------------null---------------------- D---------- 100
    ac2-------------b2------------------------C----------- 200
    I need to compare b2 and ac1 if they are different then I'll to apply a conditional formatting.
    Is there any way to perform this comparison
    Regards
    Adil

    Hi Adil,
    don't know if adding a new column making use of an analytical function (lag) can solve your problem.
    In that case I think you should be able to get ac on the same level as b2. By adding another extra column you can compare them and base your conditional format on this one.
    HOpe it helps you out.
    Kr,
    A

  • Set multi user column with PowerShell used to work in 2010 but no longer works in 2013

    In SharePoint 2010 I used PowerShell to set the value of multi user people columns and it worked really well.  I attempt to use the same PowerShell to set the same column type in SharePoint 2013 and it fails.
    here is the PowerShell that I use in 2010:
    $web = Get-SPWeb "http://intranet"
    $list = $web.lists["TestList"]
    $item = $list.items.add()
    $item["Title"] = "Test multi user column"
    $users = @("Domain\user1", "Domain\user2")
    $userList = new-object Microsoft.SharePoint.SPFieldUserValueCollection
    foreach($user in $users)
    $spUser = $web.EnsureUser($user)
    $userValue = new-object Microsoft.SharePoint.SPFieldUserValue($web, $spUser.ID, $spUser.Name)
    $userList.Add($userValue)
    $item["MultiUserColumn"] = $userList
    $item.update()
    I have used this on three SharePoint 2013 farms with differing results.  On two of them I receive an error when running $item.update(): Exception calling "Update" with "0" argument(s): "Invalid look-up value.  A look-up
    field contains invalid data. Please check the value and try again."
    If I take one of the users out of the $users list then it works fine, but it will not allow multiple users to be set with PowerShell.  I can use the GUI to add more than one user but not PowerShell.
    Does anyone know if these methods have changed in 2013? I haven't been able to find anyone else with this issue.
    mmm... coffee...

    Not sure but maybe something to do with casting. Below is the code snippet from one of the blogs. Try modifying your script like below and see if still you get the error
    [Microsoft.SharePoint.SPFieldUserValueCollection]$lotsofpeople = New-Object Microsoft.SharePoint.SPFieldUserValueCollection
    $user1 = $w.EnsureUser("domain\user1");
    $user1Value = New-Object Microsoft.SharePoint.SPFieldUserValue($w, $user1.Id, $user1.LoginName)
    $user2 = $w.EnsureUser("domain\user2");
    $user2Value = New-Object Microsoft.SharePoint.SPFieldUserValue($w, $user2.Id, $user2.LoginName);
    $lotsofpeople.Add($user1Value);
    $lotsofpeople.Add($user2Value);
    $i["lotsofpeoplefield"] = $lotsofpeople;
    $i.Update();
    #-or-
    $l.Fields["lotsofpeoplefield"].ParseAndSetValue($i,$lotsofpeople);
    $i.Update();
    Reference to the link
    http://social.technet.microsoft.com/wiki/contents/articles/20831.sharepoint-a-complete-guide-to-getting-and-setting-fields-using-powershell.aspx
    Geetanjali Arora | My blogs |

  • How to do product with sum using DAX

    Hi Everyone,
    How I can get the Value result using DAX:
    Calculation for Value on 3/1/2014: 6*20 + 10*10 + 4*30 = 340 
                                       4/1/2014: 8*30 + 2*10 + 0*40 = 260 .....
    so on...
    Please reply on this...
    Performance of the measure also the big concern

    Especially if you are worried of performance issues, you should use Power Query as a tool for preparing your data before loading into your Power Pivot data model.
    In this case: Unpivot both tables, join them on Date & Currency code and create a new column: CurrVal(from first table) * CurrVal (from second table). Then group on Date, Sum your new value and ignoare Curr-Columns: There
    goes your target value.
    Then directly load to PP data model if you’re using 2013.
    Imke

  • How to compare character with \ ?

    Hi,
    How can I compare a character with backslash ?
    when I do 
    if  (c == '\')
    then it gives error invalid character constant
    I cant even declare string with this value like
    String str = "\";
    this gives error string literal is not properly closed by double qoute
    thanks in advance
    B

    Hi,
    You can use the below
    String str = "\\";
    char c = '\\';
    * are considered as \ at runtime.
    Regards,
    Sruti

  • Join file column with column in another database

    Hi all,
    I am trying to do a join between a column in a file I've imported into the BI Server with a column from a Oracle database table in the BI server, but I only get the error:
    *[NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: 37000 code: -3554 message: [Microsoft][ODBC Text Driver] Syntax error in ALTER TABLE statement.. [nQSError: 16015] SQL statement execution failed. (HY000)*
    Joining columns between other files works but not when joining with another database table.The log seems OK, it executes the 2 SQL queries as it should but it cannot join the values in the BI Server memory (it seems). VARCHAR field, but I tried with several different types.
    Any help appreciated.

    There are many ways of doing this, you could potentially use a Dates table to help you out but the comparison between your Excel report and the Oracle table would be pretty straightforward with just 1 calculated column / just a true&false calc column
    so you can filter it would be nice.
    The dates table can help you so you can only get always the dates from the current month. You can read more about that in the following
    Link
    Hope this helps!

  • How to link javabean with c using jni

    I am doing a program about using jni to load a c .But when I was using jni with javabean, under tomcat, it didn't work . Please show me a way.
    my code�F
    /////TestJNI.java
    package com.jsp;
    public class TestJNI{ 
    private byte[] cbuff={49,48,48,48,100,0x0};
    public byte getchar(int i)
    return cbuff;
    public native int GetRandom(byte[] pRandom,int j);
    static
    System.loadLibrary( "TestJNI" );
    public void Execute()
    int r=GetRandom(cbuff,4);
    /////BeanTest.jsp
    <jsp:useBean id="TestJNI" scope="session" class="com.jsp.TestJNI">
    </jsp:useBean>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <%=TestJNI.getchar(4)%>;
    <%
    TestJNI.Execute();
    %>
    <br>
    <%=TestJNI.getchar(4)%>
    </body>
    </html>
    //////TestJNI.cpp
    //TestJNI.cpp
    #include"com_jsp_TestJNI.h"
    #include<stdio.h>
    JNIEXPORT jint JNICALL Java_com_jsp_TestJNI_GetRandom (JNIEnv *env,  jclass,  jbyteArray  pRandom,  jint  j)   
    jsize size = env->GetArrayLength((jarray)pRandom);
    jbyte *arrayBody    =  (env)->GetByteArrayElements(pRandom,NULL); 
    jbyte buff[5];
    buff[0]=31;
    buff[1]=32;
    buff[2]=33;
    buff[3]=34;
    buff[4]=35;
    env->SetByteArrayRegion(pRandom,0,5,buff); // set byte[] values
    return (jint)100;
    I put TestJNI.class under directory com/jsp/�Cput TestJNI.dll under classes directory�B
    erro information�F
    java.lang.NoClassDefFoundError
         sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         java.lang.reflect.Constructor.newInstance(Constructor.java:274)
         java.lang.Class.newInstance0(Class.java:308)
         java.lang.Class.newInstance(Class.java:261)
         java.beans.Beans.instantiate(Beans.java:204)
         java.beans.Beans.instantiate(Beans.java:48)
         org.apache.jsp.beantest_jsp._jspService(beantest_jsp.java:45)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

    You can test a normal Class(not a JNI call) invoking in BeanTest.jsp
    1.If there is no problem it's most likely you can't get library path set in server enviroment
    (here: System.loadLibrary( "TestJNI" ); )
    2.If the same exception occurs ,you should check your webapps tree structure.
    please refer to the 2 links if you can read chinese
    http://www.chinaitlab.com/www/news/article_show.asp?id=36677
    http://www.javaresearch.org/article/showarticle.jsp?column=1&thread=4653

  • How to solve problem with where-used list?

    I've the problem that in many places of my FPM (floorplan manager, web dynpro) code the where-used list does not work anymore because the FPM functions force the developer to specify structure of column names by literals. So for example in the UIBB's GET_DEFINITION methods or when using the following piece of code in some PROCESS_EVENT function:
    CASE io_event->mv_event_id.
         WHEN if_fpm_guibb_list=>gc_guibb_list_on_cell_action.
         io_event->mo_event_data->get_value(
              EXPORTING
                   iv_key = if_fpm_guibb_list=>gc_event_par_column_name
              IMPORTING
                   ev_value = lv_col_name
              if ( lv_col_name = 'FOO' ).
              endif.
    endcase.
    Here one must comapare (line 9) the variable lv_col_name with some literal containing the name of an element of a structure. So the where-used list on STRUCT-FOO does not find this source. Is there any way to fix this problem? I thought to use RTTI for it, but could not find any way to do this. Possibly, is there any pragam or pseudo comment to update the where-used list of a specific structure at a given place?

    The point is that when I start using RS_ABAP_SOURCE_SCAN I have to remember to do this I don't like the situation that after changing some name of a structure's element, the source code of the whole application is correct, no error will occur but the behaviour of the application may be totally wrong. Possibility a better solution will be to add some constants containing the structure element names to the model class of the FPM application.

  • How to compare date with thr current date

    Hi,
    I have an inout string which is in date format(dd/mm/yyyy hh:mm:ss) .
    what i need to do is comparing this date string with the current date. if my input string is less than current date , then display error message..
    how to do this?
    regards

    Excellent suggestions from all of you people!
    finally i got the solution
    code is:
    import java.util.*;
    import java.text.*;
    public class TestDate {
      public static void main(String args[]){
        TestDate a = new TestDate();
      TestDate() {
        String DATE_FORMAT = "dd/MM/yyyy hh:mm:ss";
         Date today = new Date();
         Date myDate=null;
        java.text.SimpleDateFormat sdf =
             new java.text.SimpleDateFormat(DATE_FORMAT);
         try{
         myDate = sdf.parse("01/06/2006 00:00:00");
         }catch(Exception e) {System.out.println(e);}
        Calendar c1 = Calendar.getInstance();
        Calendar c2 = Calendar.getInstance();
        c1.setTime(today);
        c2.setTime(myDate1);
        System.out.print(sdf.format(today));
        System.out.print(sdf.format(c1.getTime()));
        if (c1.before(c2)) {
           System.out.print(" is before ");
        if (c1.after(c2)) {
           System.out.print(" is after ");    
        if (c1.equals(c2)) {
           System.out.print(" same as ");    
    System.out.print(sdf.format(c2.getTime()));
      }

Maybe you are looking for