Search Results

Search found 6988 results on 280 pages for 'if else statement'.

Page 86/280 | < Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >

  • iOS Development: Why isn't my try block catching the exception?

    - by BeachRunnerJoe
    Hi. I have an exception being thrown in my code, but when I wrap it in an try/catch block, it doesn't get caught. The NSLog statement is never called in the catch block. Here's the code... NSInteger quoteLength; [data getBytes:(void *)&quoteLength range:NSMakeRange(sizeof(messageType), sizeof(quoteLength))]; @try { //Debugger stack trace shows an NSException being thrown on this statement NSData *stringData = [data subdataWithRange:NSMakeRange(sizeof(messageType) + sizeof(quoteLength), [data length])]; NSString *quote = [[NSString alloc] initWithData:stringData encoding:NSUTF8StringEncoding]; NSLog(@"received quote: %@",quote); [quote release]; } @catch (NSException * e) { NSLog(@"Exception Raised: %@", [e reason]); } Why doesn't it get caught? Thanks so much!

    Read the article

  • Subsonic: Select on a View, locks the table update?

    - by Jay
    Hi, I have a Web site live and running now. I am using the Subsonic to handle the database connections etc. I am getting time out expired error while updating a table (say Employee). When I check sp_who2, I see the suspended connection for the PID which is updating with a block by anothor pid, so I run the profiler and found out when ever this suspended connection occur, the blocked pid is a select statement on the view (say ActiveEmployees, which is the same as the table but with some where conditions). Anyone know why a Select statement on the view could cause failure in update. If it is other (like select fails due to update) may be reasonable. Is there any way for me to make select on a view without locking the table? PS: I am using the Sql server 2005 and subsonic 2.2. Thanks

    Read the article

  • How to update a record with multiple keys

    - by OceanBlue
    I am trying a database app on Android. I want to use the SQLiteDatabase update(...) convenience method to update a record. Normally, for a WHERE clause of a single key this is working. Following code is working fine:- values.put("testname", "Quiz1"); mDB.update("Tests", values, "id=?", new String[]{"2"}); //this statement works However, I want to update a column in a table which has a combination of two keys as the unique identifier. I tried the following. This executes without exception, but nothing is updated. values.put("score", 60); mDB.update("Results", values, "studentid=? AND testid=?", new String[] { "2,1" }); // this statement does not work How to do it?

    Read the article

  • sqlite error :/* SQL error or missing database */

    - by user262325
    Hello everyone I have a project in which I stored sqlite database file "data.sqlite3" to 'Group'&files'-'resource' Below are my viewcontroller source codes //-myviewcontroller.h #import "sqlite3.h" #define kFilename @"data.sqlite3" //myviewcontroller.m -(NSString *)dataFilePath { NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; return [documentsDirectory stringByAppendingPathComponent:kFilename]; } -(void)f { if (sqlite3_open([[self dataFilePath] UTF8String],&database)!=SQLITE_OK) //dataFilePath returns ///Users/interdev/Library/Application Support/iPhone Simulator/User/Applications/095C6E05-4EAE-4817-883E-A72E39D439E0/Documents/data.sqlite3 { sqlite3_close(database); NSAssert(0,@"Failed to open database");//no problem } NSString *query = @"SELECT * FROM table1 ORDER BY ROW";//table1 is table name sqlite3_stmt *statement; NSInteger v=sqlite3_prepare_v2( database, [query UTF8String], -1, &statement, nil); NSString *zs= [NSString stringWithFormat:@"%d",v]; NSLog(@" The buttontitile is %@ ",zs); if ( v == SQLITE_OK) { // ... } I checked value of v in log, it always is 1 #define SQLITE_ERROR 1 /* SQL error or missing database */ I do not know why this happened.

    Read the article

  • Is it possible for a Grails Domain to have no 'id'?

    - by firnnauriel
    Is it possible to create a table that has no 'id'? For example, this is my domain: class SnbrActVector { int nid String term double weight static mapping = { version false id generator: 'identity' } static constraints = { } } When I run this SQL statement, it fails: insert into snbr_act_vector values (5, 'term', 0.5) I checked the table and 'id' is already set to autoincrement. I'm thinking that another option is to remove the 'id' itself. Or is there another workaround for this? Please assume that it is not an option to change the givent SQL statement.

    Read the article

  • How to write a variable with input ?

    - by ldigas
    the title is somewhat vague, so let me explain I'm trying to ask the user for a value of some variable, but at the same time, showing him the last value used (at the termination of the program, the values are saved to a file, and loaded at the start of the program). Something like this: Enter new radius value (R=12.6) : ... user enters 12.7 ... Enter new pi value (pi=3.14) : Enter new height value (h=30.0) : Usually I would write the first one with write statement, then read the new one (in fortran, for example). In matlab however, I don't know how to write something out with input statement. Are there some other statements for getting input ? All your thoughts on the subject appreciated.

    Read the article

  • Grouping date periods (by number of days) but exclude the weekends?

    - by tonyyeb
    I have a table with start and end dates in. My goal is to have a table that has grouped these dates into how many days the period spans. I thought I had the solution with a simple SQL statement (MS SQL Server 2005) but I want to exclude weekends. SELECT DATEDIFF(D, StartDate, EndDate)+1 AS Days, COUNT(ID) as Count FROM myDateTable GROUP BY DATEDIFF(D, StartDate, EndDate) This gives a record set of: Days Count 1 4 2 2 4 1 7 2 Is this possible to exclude the weekends in the SQL statement and if not can it be done using ASP and a array perhaps?

    Read the article

  • Why is selecting specified columns, and all, wrong in Oracle SQL?

    - by TomatoSandwich
    Say I have a select statement that goes.. select * from animals That gives a a query result of all the columns in the table. Now, if the 42nd column of the table animals is is_parent, and I want to return that in my results, just after gender, so I can see it more easily. But I also want all the other columns. select is_parent, * from animals This returns ORA-00936: missing expression. The same statement will work fine in Sybase, and I know that you need to add a table alias to the animals table to get it to work ( select is_parent, a.* from animals ani), but why must Oracle need a table alias to be able to work out the select?

    Read the article

  • C++11/14 and return( ... ) vs return

    - by user2485710
    In C++ you are allowed to write a return statement that looks like : return ( ... ); which is different from the more popular : return ... ; In particular the first version returns the address/reference of something that is local to the stack of the function which contains that return statement. Now why something would like to return a reference to something that, at that point, has no lifetime ? What are the use case for this idiom ? Considering the new buzzword and features from C++11 and C++14 there is a different usage for this ?

    Read the article

  • C++ Types Impossible to Name

    - by Kirakun
    While reading Wikipedia's page on decltype, I was curious about the statement, Its [decltype's] primary intended use is in generic programming, where it is often difficult, or even impossible, to name types that depend on template parameters. While I can understand the difficulty part of that statement, what is an example where there is a need to name a type that cannot be named under C++03? EDIT: My point is that since everything in C++ has a declaration of types. Why would there ever be a case where it is impossible to name a type? Furthermore, aren't trait classes designed to yield type informations? Could trait classes be an alternative to decltype?

    Read the article

  • Oracle global_names DELETE problem

    - by jyzuz
    I'm using a database link to execute a DELETE statement on another DB, but the DB link name doesn't conform to global naming, and this requirement cannot change. Also I have global_names set to false, and cannot be changed either. When I try to use these links however, I receive: ORA-02069: - global_names parameter must be set to TRUE for this operation Cause: A remote mapping of the statement is required but cannot be achieved because GLOBAL_NAMES should be set to TRUE for it to be achieved. - Action: Issue `ALTER SESSION SET GLOBAL_NAMES = TRUE` (if possible) What is the alternative action when setting global_names=true is not possible? Cheers, Jean

    Read the article

  • How do you DELETE rows in a mysql table that have a field IN the results of another query?

    - by user354825
    here's what the statement looks like: DELETE FROM videoswatched vw2 WHERE vw2.userID IN ( SELECT vw.userID FROM videoswatched vw JOIN users u ON vw.userID=u.userID WHERE u.companyID = 1000 GROUP BY userID ) that looks decent to me, and the SELECT statement works on its own (producing rows with a single column 'userID'. basically, i want to delete entries in the 'videoswatched' table where the userID in the videoswatched entry, after joining to the users table, is found to have companyID=1000. how can i do this without getting the error in my sql syntax? it says the error is near: vw2 WHERE vw2.userID IN ( SELECT vw.userID FROM videoswatched vw JOIN users u and on line 1. thanks!

    Read the article

  • Rails botches the SQL on a complex save

    - by Dan B
    Hi, I am doing something seemingly pretty easy, but Rails is messing up the SQL. I could just execute my own SQL, but the framework should be able to handle this. Here is the save I am trying to perform: w = WhipSenVote.find(:first, :conditions => ["whip_bill_id = ? AND whip_sen_id = ?", bill_id, k]) w.votes_no = w.votes_no - 1 w.save My generated SQL looks like this: SELECT * FROM "whip_sen_votes" WHERE (whip_bill_id = E'1' AND whip_sen_id = 7) LIMIT 1 And then: UPDATE "whip_sen_votes" SET "votes_yes" = 14, "updated_at" = '2009-11-13 19:55:54.807000' WHERE "id" = 15 The first select statement is correct, but as you can see, the Update SQL statement is pretty wrong, though the votes_yes value is correct. Any ideas? Thanks!

    Read the article

  • Why did this code still work?

    - by bstullkid
    Some old code that I just came across: MLIST * new_mlist_link() { MLIST *new_link = (MLIST * ) malloc(sizeof(MLIST)); new_link->next = NULL; new_link->mapi = NULL; new_link->result = 0; } This was being called to build a linked list, however I noticed there is no statement: return new_link; Even without the return statement there, the list still got built properly. Why did this happen? EDT: Platform: Mandriva 2009 64bit Linux 2.6.24.7-server GCC 4.2.3-6mnb1

    Read the article

  • Aborted core dumped C++

    - by avd
    I have a large C++ function which uses OpenCV library and running on Windows with cygwin g++ compiler. At the end it gives Aborted(core dumped) but the function runs completely before that. I have also tried to put the print statement in the end of the function. That also gets printed. So I think there is no logical bug in code which will generate the fault. Please explain. I am also using assert statements.But the aborted error is not due to assert statement. It does not say that assertion failed. It comes at end only without any message. Also the file is a part of a large project so I cannot post the code also.

    Read the article

  • java switch case question

    - by hkvega
    public String sizeOfSupermarket() { String size; switch (this.numberOfProducts) { case (this.numberOfProducts > 5000): size = "Large"; break; case (this.numberOfProducts > 2000 && this.numberOfProducts < 5000): size = "Medium"; break; case (this.numberOfProducts < 2000): size = "Small"; break; } return size; } the above is wrong, how to write the compare statement in case statement?

    Read the article

  • remove a varchar2 string from the middle of table data values

    - by Michelle Daniel
    Data in the file_name field of the generation table should be an assigned number, then _01, _02, or _03, etc. and then .ldf (example 82617_01.pdf). Somewhere, the program is putting a state name and sometimes a date/time stamp, between the assigned number and the 01, 02, etc. (82617_ALABAMA_01.pdf or 19998_MAINE_07-31-2010_11-05-59_AM.pdf or 5485325_OREGON_01.pdf for example). We would like to develop an SQL statement to find the bad file names and fix them. In theory it seems rather simple to find file_names that include a varchar2 data type and remove it, but putting the statement together is beyond me. Any help or suggestions apprecuiated. Something like ........... UPDATE GENERATION SET FILE_NAME (?) WHERE FILE_NAME (?...LIKE '%STRING%');?

    Read the article

  • How do I take the advantage of the variable column key/value structure of Cassandra

    - by icejade
    If I have to predefine all the columns, how do I take the advantage of the variable column key/value structure of cassandra? If I use update table command, it will insert null for all the rows which don't have that column. This is same as relational DB. For example, for contact column family, I have name, phone, email. I have 100 contacts have all 3 field. Then number 101 contact has skype id which I want to add. If I use insert statement, it won't let me add skypeid since it's not defined in the CF. So I have to run alter statement to change the CF, then all the first 100 contacts will have a null field for each of them.

    Read the article

  • Is there any difference between SQL running in code vs the MySQL command line?

    - by MJB
    I have a SQL update statement I am running from inside a PHP program. It is prepared and then executed. When I run it in PHP, it reports a constraint violation. When I run the exact same statement from the command line (which I am getting via dBug()), it works with no errors. This sounds impossible, so I keep looking for differences between the statements. The only thing I can see is that when I execute it with an array of arguments, they all appear to be chars, when some should be integers. Any suggestions for where to look? I can post the code, but that does not seem like it would be helpful, because the code works.

    Read the article

  • SQL query not working

    - by Ziv
    hi, I'm trying to create a query in an access database for a C# dataset using the query editor but the created method says there is a problem and isn't created correctly. SELECT Discs.* FROM Discs WHERE (Title=@Title OR @Title IS NULL) AND (Type=@Type OR @Type IS NULL) AND (ContainerID=@ContainerID OR @ContainerID IS NULL) AND NOT (@Title IS NULL AND @Type IS NULL AND @ContainerID IS NULL) the error is: Generated SELECT statement. Error in WHERE clause near '@'. Unable to parse query text. the generated select method doesn't have any parameters and is unusable. I've tried the exact same SQL statement in the access query and it worked flawlessly, what am I supposed to be doing differently when transferring it to C#?

    Read the article

  • Problem with $.get while submitting form

    - by bradenkeith
    I'm trying to verify that an Account Name is not already in use once a user fills out a form. The code looks like: $("#add_account").submit( function () { $.get( "'.url::site("ajax/check_account_name").'", {account_name: "t"}, function(data){ alert( data ); }); }); I get a $.get response if the statement sits like this: $(document).ready( function () { $.get( "'.url::site("ajax/check_account_name").'", {account_name: "t"}, function(data){ alert( data ); }); }); Which leads me to believe that my $.get statement is correct. Is there some jQuery rule I'm not familiar with that would cause this to fail in on submit scenario? In code block 1, I get values returned like they should. Block 2 gives me a blank response. Any ideas? Thanks for your time, I know you have better things to be doing.

    Read the article

< Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >