SQL query does not run...

Hi all

In fact I'm trying recover the data of the mobile database table in the code snippet

below the program runs until the dialog box display the string «after querry» and after that

throw an exception.

can anyone solve the problem...

try
{
//URI myuri = URI.create("file:///SD Card/databases/myTree/myTeam.db");
URI myuri = URI.create("file:///SDCard/databases/myTree/"+"myTeam.db");
    Dialog.alert("Database opened");
    Dialog.alert("Database opened");
    data = DatabaseFactory.openOrCreate(myuri);
    Dialog.alert("before query");
    st = data.createStatement("SELECT * FROM mobile WHERE name="+text);
    Dialog.alert("After querry");
    st.prepare();
    Cursor c = st.getCursor();
    int i = 0;
    Dialog.alert("Before while");
    while(c.next())
    {
        Dialog.alert("in the while");
        r = c.getRow();
        i++;
Dialog.alert(r.getString(0)+r.getString(1)+r.getString(2)+r.getString(3));
        //name1.setText(r.getString(0));
        //email1.setText(r.getString(1));
        //phone1.setText(r.getString(2));
        //skype1.setText(r.getString(3));
    }
    st.close();
    data.close();
}
    catch (Exception e)
    {
    e.printStackTrace();
    Dialog.alert(e.toString());
}

Thanks in advance...

Saran

Well, it would be useful if we can say which line threw the exception and if you could be a little more specific about what 'some exception' is in reality.

I think, however, is that the problem is how you create your declaration. Instead of directly in the statement of interpolation "text":

st = data.createStatement("SELECT * FROM mobile WHERE name="+text);

You must create a query that contains a placeholder for text and then bind the text of the statement:

st = data.createStatement("SELECT * FROM mobile WHERE name=?");
st.prepare();
st.bind(1, text);

If this solves the problem, it's how you build such declarations in all cases.

Tags: BlackBerry Developers

Similar Questions

  • query does not run strange

    For some strange reason, the following query 1 runs but the 2nd query does not run...
    observe the slight difference for local conditions and quotes from final for her... in the first query the final citation is in the second line.
    I bring as query 2 but she sends me results I also tried ltrim (rtrim (local) = "en_US", it does not help
    What is the problem here?


    Query 1
    --------
    SELECT *.
    Of ats_rules_bkp
    Subclass WHERE = "payments".
    CATEGORY = "qsg.
    AND clazz = 'help '.
    AND right = "ach".
    AND country = 'India '.
    AND region = "South".
    AND market_segment = "primary".
    AND local = "en_US
    '
    AND status = 'Active '.

    ---------------------------------------------
    Query 2

    SELECT *.
    Of ats_rules_bkp
    Subclass WHERE = "payments".
    CATEGORY = "qsg.
    AND clazz = 'help '.
    AND right = "ach".
    AND country = 'India '.
    AND region = "South".
    AND market_segment = "primary".
    AND local = "en_US."
    AND status = 'Active '.

    As I expected, you have a carriage return in your data. the LOCAL column is not store the string "fr_FR." It has an extra carriage return (character ASCII 10) data. You can modify the query to add the character CHR (10)

    local = 'en_us' || CHR(10)
    

    but it is probably more sensible to fix the underlying data, if this is in fact to store the string "fr_FR."

    Justin

  • SQL query does not work well

    Hello
    I did a small table with 5 rows and want to make a consult sql using rownum

    so I'm running
    select * from mytable where rownum = 1;
    and it gives me the first line but if I change the 1 to a 2 or 3 or 4 or 5, it is said that there's nothing: S

    why?????????????????????

    But if I change to between 1 and 5, he gave me 4 rows: S: S

    why???????????????????

    Try this:

    SELECT *
    FROM (
       SELECT bne.*, rownum myrow
       FROM BAN_EVENTOS_CONFIRMACION bne WHERE ROWNUM <=5)
    WHERE myrow = 2;
    
  • SQL query does not work coccrectly

    The table contains the list of months and years.
    When I write
    SOME MONTHS, YEAR FROM MONTH_DETAILS ORDER BY DESC, YEAR DESC;
    It works correctly and returns
    MONTH YEAR
    7 2009
    6 2009
    5 2009
    4 2009
    3 2009
    2 2009
    1 2009
    12 2008
    11 2008
    But when I want to get only the first (month = 7 and year = 2009) and change the query like this
    SOME MONTHS, the YEAR OF MONTH_DETAILS WHERE ROWNUM = 1 ORDER BY YEAR DESC, DESC;
    It returns
    MONTH YEAR
    2 2009
    .
    What is the problem?
    The year and month fields are defined as numbers.
    SELECT MONTH,YEAR FROM (select * from MONTH_DETAILS ORDER BY YEAR DESC,MONTH DESC) WHERE ROWNUM=1 
    

    first make order and apply the rownum on him...

    Ravi Kumar

  • Why PL/SQL procedures does not allow users to enter data dynamically at run time?

    Dear all,

    I tried to do a procedure that will search for a group of approval in our database that matches.

    (1) the number of levels

    (2) the number of users by each level

    (3) the id of users by level

    entered by the user.

    I tried various methods to receive user input dynamically at run time, but in vain.

    Finally finished my procedure allowing the user to enter the parameters and then executes the procedure, to which these parameters are passed as arguments. (1 variable for the number of levels and 2 userdefinedarrays with the number of users by level and level respectively)

    Why PL/SQL procedures does not allow users to enter data dynamically at run time?

    Thanks in advance,

    Séverine Suresh

    HEY, Sebastian,

    3035408 wrote:

    Hello Sir,

    My question is that if I'm going to say, the number of levels 5, is there any way by which, at runtime, the procedure prompts me to enter at the start of the number of users per level. Now as soon as I get the number of users per level can I do the procedure ask me to enter the nicknames of the members of each level. I mean, something like a invite.

    Thank you

    Séverine Suresh

    There is no way to do it in SQL or PL/SQL, because not SQL PL/SQL is a way to get user input.  User interaction is a job for your front end, like Zlatko tool suggested in response to #5.  If your front end tool is SQL * Plus, you can use the substtitution variables, as Jarkko showed in response #6.

  • Payroll Run query does not appear on the payroll LOV

    Hi all

    Am on 12.1.3
    DB - 11 GR 1 material

    Wen, trying to run on PAYROLL:
    FACE below error:
    Payroll Run query does not appear on the payroll LOV


    Thank you

    Please post the exact name of the simultaneous program you want to submit as well as all the parameters.

    I understand that you get an error when you try to select the LOV to pass parameters, right?

    If the program has not yet been presented, then it is an expected behavior not to find any file of log/output.

    Please see if these MOS Docs Help.

    Simultaneous request for payroll, payroll name Lov for payroll run Erros: APP-FND-1436: the list of values can not find all the values for you to choose [333524.1 ID]
    Payroll run parameter list of values (LOV) in the process "Retry Payroll Run" does not display any values [1368390.1 ID]

    Thank you
    Hussein

  • The Oracle optimizer automatic statistical work does not run after full import

    Hi all

    I did a full import in our QA database, import was successful, but GATHER_STATS_JOB does not work after sep 18 2010 if its activation and on demand, I question last_analyzed table to check and confirmed that he has not run after sep18, 2010.

    See below for the output

    OWNER JOB_NAME HIS STATE START_DATE END_DATE LAST_START_DATE NEXT_RUN_D
    ------------ ------------------------------ ----- --------------- ---------- ---------- ------------------- ----------
    SYS TRUE REGULAR GATHER_STATS_JOB 2010-09-18 06:00:02


    Collection of statistics work defined automatic optimizer Oracle

    =======

    SQL > select JOB_NAME, STATUS, OWNER, REQ_START_DATE,.
    TO_CHAR (ACTUAL_START_DATE, ' dd-mm-yyyy HH24:MI:SS) ACTUAL_START_DATE, RUN_DURATION
    of dba_scheduler_job_run_details where
    job_name = order of 'GATHER_STATS_JOB' by ACTUAL_START_DATE asc; 2 3 4

    OWNER JOB_NAME STATUS REQ_START_DATE ACTUAL_START_DATE
    ------------ ------------------------------ ------------ ------------------------------ ------------------------------
    RUN_DURATION
    --------------------
    SYS GATHER_STATS_JOB MANAGED 16/09/2010 22:00
    + 000 00:00:22

    SYS GATHER_STATS_JOB SUCCEEDED 2010-09-17 22:00:02
    + 000 00:00:18

    SYS GATHER_STATS_JOB SUCCEEDED 2010-09-18 06:00:02
    + 000 00:00:26


    What could be the reason for the GATHER_STATS_JOB job does not although his game to automotive

    SQL > select dbms_stats.get_param ('AUTOSTATS_TARGET') of double;

    DBMS_STATS. GET_PARAM ('AUTOSTATS_TARGET')
    ------------------------------------------------------------------------------------------------------------------------
    Auto

    Someone has this kind of experience, please share
    Apprecitate your answers

    Concerning
    SRH

    ? So basically you're saying is if none of the tables are changed then GATHER_STATS_JOB will not work, but I see tables are updated again the task does not run. I did > dba_scheduler_jobs request and the State of employment are true and regular. Please see my previous post on the output

    Am I missing something here, I get some parameters parameters

    So basically you are saying is if none of the tables are changed then GATHER_STATS_JOB will not work.

    GATHER_STATS_JOB will take place, and if there is no table in which there is a 10% change in the data, it will bring together statistics on this table. If no data in the table have changes less than 10 percent, it will bring together not statistics.

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14211/stats.htm#i41282

    I hope this helps.

    -André

  • My pl/sql codes does not in the express edition, which can do?

    pls help me my pl/sql codes does not work in oracle 10g express edition, which can do? pls help me.

    You must open a window for cmd.exe with Windows Start menu, then run, and type: cmd.exe. The rest is in my previous message.

  • 1.5.4 - SQL-spreadsheet SQL-Developer does not use the owner of the Table

    In older versions of the sql developer, you can remove a table in the spreadsheet and was built a select query. With the new version 1.5.4 - owner of the table is ' % s ' and you must inform the owner of the table or the query does not work with tables of other users.

    Is this a bug or is there the possibility to change the settings to delete tables in the SQL-worksheet with the owners of the table.

    You're DND from the node of the Table under the node of the other user? If so, I'm able to reproduce the problem you're talking about. Otherwise I still not got you problem clearly.

  • void VI does not run with the main VI.

    My main and sub VI is attatched.

    danil33 wrote:

    Re: void / VI does not run with the main VI.

    When you start your main program, the Subvi is called and the main VI must wait the Subvi before it can continue. However, the Subvi is not set to open the Panel before, so very probably that it runs in the background for 100 seconds (1000 iteration to 100ms), because no one can press the stop button at the beginning to put an end to the Subvi. Once the Subvi is completed, the last value is returned to the main VI via the output connector and the main VI can process and display this last value. At this point, the main VI stops, because it's done (hopefully you do not "continuous operation").

    Obviously you have some misconceptions of beginners on the stream. Please we tell exactly what you expect the program to do, and we might be able to point in the right direction.

  • Windows Media player on my machine does not run some AVI files. How can I check what the problem with AVI files. Files are running in other utilities of free ware

    Windows Media player on my machine does not run some AVI files. How can I check what the problem with AVI files. Files are running in other utilities free ware. Also, windows Explorer does not display dimension and other video related information for the file. Y at - it a tool that can indicate what exactly is the problem with the file.

    Ritu

    Hello

    1. you get any error message?

    2. don't you make changes to the computer before the show?

    Please follow the steps from the link below.

    http://support.Microsoft.com/kb/279242

  • Program does not run in the emulator.

    Hello, I develop in Netbeans, version 7, I use J2ME and this the first time that I try to compile an application for BlackBerry, I download all the framework I need to develop an application for BlackBerry, I'm trying to run my program and the emulator of the BlackBerry beginning but my program does not run, I have no exception and any error, please if anyone can help me Thanks in advance.

    You can publish detailed information for we can help you as your code runs only not, what your average frame, etc...

  • Dictionary of Cambridge Advanced Learner does not run on windows 7 os.

    Dictionary of Cambridge Advanced Learner does not run on windows 7 os.

    What are the 'system requirements' for this software?

    Have you tried right clicking on the shortcut to the program or the .exe and select "Run As Administrator"?  Perform, even if your user name is an administrator.

    Try right-clicking on the real Setup.exe when you are installing the program and selecting the option "Run As Administrator"?  Perform, even if your user name is an administrator.

    Make older programs in this version of Windows (Windows 7)
    http://Windows.Microsoft.com/en-us/Windows7/make-older-programs-run-in-this-version-of-Windows

    Help with Windows 7 compatibility issues
    http://Windows.Microsoft.com/en-us/Windows7/help/compatibility

    Windows 7 Compatibility Center
    http://www.Microsoft.com/Windows/compatibility/Windows-7/en-us/default.aspx

  • a preparation free gata with GK Publications cd does not run on windows 7 Home Basic.

    A cd of free door preparation with GK Publications does not run on windows 7 Home Basic.

    I have buyed a book for the preparation of the door named GK Department with a cd inside, it includes the series of door documents test to practice. But it is to create an error message problem showing that Microsoft.jet.OLEDB.4.0' is not regestered on the local computer.    Please sort out the problem as soon as possible.

    Hi preyashi,

    Thanks for posting your question in the Microsoft community forum!

    I understand that you are having problems running a program from a CD on your computer. I'll help you solve the problem. To be able to understand the question in a better way, I would like to ask you a few questions.

    (1) did you make any changes before the show?

    (2) you are able to run the other Setup program on your computer?

    Senario 1:

    See if it is compatible with Windows 7.

    If this isn't the case, you could try installing in compatibility mode for Windows Vista or Windows XP.

    If the program is not compatible, then you try to install and run the program in compatibility mode.

    Use the following steps:

    (1) right click on the program.

    (2) click on Properties.

    (3) click on the tab compatibility.

    (4) select run this program in compatibility mode and select Windows Vista or other operating system, the program has been run successfully.

    Check out the link here: make sure to run older programs in this version of Windows

    http://Windows.Microsoft.com/en-us/Windows7/make-older-programs-run-in-this-version-of-Windows

    If compatibility is not successful, then try and run the program compatibility problems:

    1. open the troubleshooting program compatibility Troubleshooter by clicking the Start button.

    Then click on Control Panel. In the search box, type troubleshooting, and then click Troubleshooting. Under programs, click on run programs for previous versions of Windows.

    2. follow the instructions in the troubleshooting.

    If you are unable to install a program, insert the installation disc for the program and, using the Troubleshoot utility, navigate to the program setup file, usually called Setup.exe, Install.exe, or something similar. This utility is not designed to work on programs that have an .msi file name extension.

    Senario 2:

    The behavior you describe is expected if your application runs in 64-bit mode, all components that use must also be 64-bit. There is no 64-bit Jet OLE DB Provider, so that you get the message as described. You will receive a similar error when you try to connect to a database by using OLE DB or ODBC if there is no 64-bit of the specified OLE DB provider or ODBC driver version.

    This problem occurs only in applications that run in 64-bit mode. Compiling the application so that it works only in 32-bit mode is the current best solution.

    You may need to contact the manufacturer of the program to find out how to set the path target to x 86.

    More information

    32-bit and 64-bit Windows: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows7/32-bit-and-64-bit-Windows-frequently-asked-questions

    Please let me know the status of the issue. I will be happy to provide you with the additional options that you can use to get the problem resolved in Microsoft Windows.

  • I have a new HP Envy with Windows 8 desktop computer that still does not run properly. I rebooted, restored, ran chkdsk, sfc/scannow, uninstall/install update etc...

    I have a new HP Envy with Windows 8 desktop computer that still does not run properly. I have rebooted, restored (im doing this), ran chkdsk, sfc/scannow, malware, virus, uninstall/install etc and my machine wil always do not run for a long time without going through some sort of problem after an hour or two.  Can anyone suggest what to do about this? I read a lot of information online on all the windows 8 and fixes bugs, etc, but anything Microsoft/Windows, which ensures its customers, a hotfix or compesating their customers with software that still works. This isn't a hardware problem, and I can't keep day and bad shooting and trying to fix the day things in?

    Sincerely,
    A client who is a loss for words.
    Here are some problems in no particular order.
    1.) apps to not install it, and/or Windows saying they are when they are in fact not. The fix to install / uninstall, or get on the site of windows directly in general does not, and or does not at all.
    The change permissions 2.) does not work on files that you should be able to access in changing oxnership, permissions, etc.
    3.) Google chrome won't let me access my account of microsoft (or fact rarely) trying to access assistance. But internet Explorer doesn't?
    Randomly will increase from Internet 4.) a previous connection wired to wireless to a reboot.
    5.) my 8 'key' windows was only shown to me after that I have let Windows scan my machine online? Why? I paid for this... I restarted it and it says: service not available (it worked the third attempt which was 1-3 minutes after the initial analysis). Windows only showed my product ID not the key. I know that my victory. 8 was OEM when preinstalled I bought it new, but why didn't we files on it that had nothing to do with activation, appearing on dates for three weeks, or so before I bought it. What is the 'activation of the factory'?
    6 :) Windows Essentials does not hang for a long time, and the troubleshooterprogram of update simply does not work (I had to go to the website to try tp operate, the bluetooth functionality is not good that there is an error.
    7.) windows scan and repair gets stuck at 27% (Im not the only one with this problem).
    8.), avery MS Office 2013 Disappears so often and not easy to reload "we have encountered a problem.
     

    The computer manufacturer is responsible to see that it works properly with Windows 8. It says that it is a new computer I contact HP and make these problems their. If you don't get satisfactory results I turn and look elsewhere for a computer. Hope this helps and if you need another post to help and we will be happy to help you.

    The above opinion is mine and mine nothing and does not necessarily reflect that of Microsoft, it's employees, or any other Member of this forum.

    "When we try to take anything by itself, we find it hitched to everything else in the universe." -John Muir

Maybe you are looking for