Search Results

Search found 11178 results on 448 pages for 'syntax checking'.

Page 116/448 | < Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >

  • Linq to SQL - How to compare against a collection in the where clause?

    - by Sgraffite
    I'd like to compare against an IEnumerable collection in my where clause. Do I need to manually loop through the collection to pull out the column I want to compare against, or is there a generic way to handle this? I want something like this: public IEnumerable<Cookie> GetCookiesForUsers(IEnumerable<User> Users) { var cookies = from c in db.Cookies join uc in db.UserCookies on c.CookieID equals uc.CookieID join u in db.Users on uc.UserID equals u.UserID where u.UserID.Equals(Users.UserID) select c; return cookies.ToList(); } I'm used to using the lambda Linq to SQL syntax, but I decided to try the SQLesque syntax since I was using joins this time. What is a good way to do this?

    Read the article

  • error reporting issues

    - by SunnyOne
    I'm still entangled in error handling problems. After having read and tried lots of different scripts, I still do not have an overall insight on the problem. I made a syntax error on purpose and get the following error message : Parse error: syntax error, unexpected '{' in /home/directory/public_html/mypage.php on line 10 To understand how it work, as a first step, I'd like to remove this message(which I'am able to do) and replace it by a custom one. How can I customize this message ? Thanks a lot.

    Read the article

  • Index View Index Creation Failing

    - by aBetterGamer
    I'm trying to create an index on a view and it keeps failing, I'm pretty sure its b/c I'm using an alias for the column. Not sure how or if I can do it this way. Below is a simplified scenario. CREATE VIEW v_contracts WITH SCHEMABINDING AS SELECT t1.contractid as 'Contract.ContractID' t2.name as 'Customer.Name' FROM contract t1 JOIN customer t2 ON t1.contractid = t2.contractid GO CREATE UNIQUE CLUSTERED INDEX v_contracts_idx ON v_contracts(t1.contractid) GO --------------------------- Incorrect syntax near '.'. CREATE UNIQUE CLUSTERED INDEX v_contracts_idx ON v_contracts(contractid) GO --------------------------- Column name 'contractid' does not exist in the target table or view. CREATE UNIQUE CLUSTERED INDEX v_contracts_idx ON v_contracts(Contract.ContractID) GO --------------------------- Incorrect syntax near '.'. Anyone know how to create an indexed view using aliased columns please let me know.

    Read the article

  • Do preconditions ALWAYS have to be checked?

    - by Pin
    These days I'm used to checking every single precondition for every function since I got the habit from an OS programming course back at uni. On the other hand, at the software engineering course we were taught that a common precondition should only be checked once, so for example, if a function is delegating to another function, the first function should check them but checking them again in the second one is redundant. I do see the redundancy point, but I certainly feel it's safer to always check them, plus you don't have to keep track of where they were checked previously. What's the best practice here?

    Read the article

  • declare and assign value my sql stored procedure(5.0.45)

    - by naveen84n
    Hi everybody , DELIMITER $$ DROP PROCEDURE IF EXISTS quotations.sp_addservices $$ CREATE PROCEDURE quotations.sp_addservices (In categoryname varchar(25),in servicename varchar(250),in hours float,in cost float,in basis nvarchar (100)) BEGIN insert into categorydetails (Category_Name) values (categoryname); if(categoryname!=null) then DECLARE category_id int; set category_id= select max(Category_Id) from categorydetails ; insert into servicesdetails (Service_Name,Category_Id,Hours,Cost,Basis) values(servicename,category_id,hours,cost,basis); end if; END $$ DELIMITER ; This is my stored procedure .I have to retrive the value of categoryid that is posted into the database which is auto increased.Here i cant declare the variable and assign value to variable.Am getting error like Script line: 4 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE category_id int; set category_id= select max(Category_Id) from categor' at line 9 Can any one help me Thanks in advance.

    Read the article

  • Subversion Copy Hook on Windows

    - by GeoSQL
    Hi I am working on a web based project in my free time. I have SVN set up on my machine (running XP). What I would like to do is have a copy of my repository copied to the htdocs folder (Dev machine) post-commit via a hook. That way I can test my changes in a browser. I know that I can write up a .bat file, but I'm not sure what the syntax would be. I can do a basic DOS Copy command, but I saw one example that provided a username and password to SVN at copy time. Do I need to do this? Can someone point me in the right direction as far a syntax for the .bat file? Or maybe even suggest a better method. Thanks

    Read the article

  • How can I declare constant strings for use in both an unmanaged C++ dll and in a C# application?

    - by Surfbutler
    Curently I'm passing my const string values up from my C++ into my C# at startup via a callback, but I'm wondering if there's a way of defining them in a C++ header file that I can then also refer to in C#. I already do this with enums as they are easy. I include a file in both my C++ library project (via a .h file with a pragma once at the top), and my C# application (as a link): #if _NET public #endif enum ETestData { First, Second }; I know it sounds messy, but it works :) But...how can I do the same with string constants - I'm initially thinking the syntax is too different between the platforms, but maybe there's a way? Using clever syntax involving #if _NET, #defines etc? Using resource files? Using a C++/CLI library? Any ideas?

    Read the article

  • Joining two select queries and ordering results

    - by user1
    Basically I'm just unsure as to why this query is failing to execute: (SELECT replies.reply_post, replies.reply_content, replies.reply_date AS d, members.username FROM (replies) AS a INNER JOIN members ON replies.reply_by = members.id) UNION (SELECT posts.post_id, posts.post_title, posts.post_date AS d, members.username FROM (posts) as b WHERE posts.post_set = 0 INNER JOIN members ON posts.post_by = members.id) ORDER BY d DESC LIMIT 5 I'm getting this error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a INNER JOIN members ON replies.re' at line 2 All I'm trying to do is select the 5 most recent rows (dates) from these two tables. I've tried Join, union etc and I've seen numerous queries where people have put another query after the FROM statement and that just makes no logical sense to me as to how that works? Am I safe to say that you can join the same table from two different but joined queries? Or am I taking completely the wrong approach, because frankly I can't seem see how this query is failing despite reading the error message. (The two queries on there own work fine)

    Read the article

  • what is wrong with my create table SQL?

    - by George2
    Hello everyone, I am using SQL Server 2008 management studio to execute the following SQL statements, and here is the related error message from SQL Server management studio. Any ideas what is wrong? SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO Create TABLE [dbo].[BatchStatus]( [BatchID] [uniqueidentifier] NOT NULL CONSTRAINT [PK_BatchStatus_ID], [BatchStatus] [int] NULL, CONSTRAINT [PK_BatchStatus_ID] PRIMARY KEY CLUSTERED ( [BatchID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO Msg 102, Level 15, State 1, Line 3 Incorrect syntax near ','. Msg 319, Level 15, State 1, Line 8 Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon. thanks in advance, George

    Read the article

  • Java LinkedList iterator being exhausted prematurely

    - by Sujeet
    I am using LinkedList and retrieving an Iterator object by using list.iterator(). After that, I am checking it.hasNext(), real issue is while checking it.hasNext(), sometimes it returns false. I need help why this is happening, though I have elements in the list. Some code: public synchronized void check(Object obj) throws Exception { Iterator itr = list.iterator(); while(itr.hasNext()) { //This Line I get false.. though i have list size is 1 Item p = (Item)itr.next(); if(p.getId() == null) {continue;} if(p.getId().getElemntId() == obj.getId() || obj.getId() == 0 ) { p.setResponse(obj); notifyAll(); return; } } Log.Error("validate failed obj.getId="+obj.getId()+" **list.size="+list.size()*This shows 1*); throw new Exception("InvalidData"); }

    Read the article

  • C++ a map to a 2 dimensional vector

    - by user1701545
    I want to create a C++ map where key is, say, int and value is a 2-D vector of double: map myMap; suppose I filled it and now I would like to update the second vector mapped by each key (for example divide each element by 2). How would I access that vector iteratively? The "itr-second[0]" syntax in the statement below is obviously wrong. What would be the right syntax for that action? for(std::map<in, vector<vector<double> > > itr = myMap.begin(); itr != myMap.end();++itr) { for(int i = 0;i < itr->second[0].size();++i) { itr->second[0][i] /= 2; } } thanks, rubi

    Read the article

  • freeing malloc and checkin it is empty or not

    - by gcc
    char *p; p="kjkjk"; . .//there are codes which are checking another command . if(.....)//i used pointer p in only that area free(p); . . //there are codes which are checking another command . if(p==NULL) //i check whether is empty .... if(p==-1) //can we use "EOF==p " in if statement ... //are there any usage like that EOF==p else .... I think there is big error , but where?

    Read the article

  • C++ - How to efficiently find out if any string in a vector can be assembled from a set of letters

    - by Francisco P.
    Hello, everyone! I am implementing a text-based version of Scrabble for a college project. I have a vector containing around 400K strings (my dictionary), and, at some point in every turn, I'm going to have to check if there's still a word in the dictionary which can be formed with the pieces in the player's hand. I'm checking if the player has any move left... If not, it's game over for the player in question... My only solution to this is iterating through the string, one by one, and using a sub-routine I have to check if the string in question can be formed from the player's pieces. I'll implement a quickfail checking if the user has any vowels, but it'll still be woefully inefficient. Any suggestions? Thanks for your time!

    Read the article

  • Java PreparedStatement Throws MySQLSyntaxErrorException

    - by sqlBugs
    I have the following Java code: String query = "Select 1 from myTable where name = ? and age = ?"; PreparedStatement stmt = conn.prepareStatement(query); stmt.setString(1, name); stmt.setInt(2, age); ResultSet rs = stmt.executeQuery(); Whenever I run the above code, it throws an exception on line 2 (where the PreparedStatement is declared): Error 0221202: SQLException = com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? AND age = ?' at line 1 Does anyone have any suggestions about what I am doing wrong? Thanks!

    Read the article

  • Error when creating database in MySQL using Netbeans 6.8

    - by nix
    I am trying to create a database using MySQL statements in NetBeans 6.8. However, I keep getting Error code 1064. I don't know what the problem is really since the same statements work in NetBeans 6.0. Here is the error: Error code 1064, SQL state 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; /*!40000 ALTER TABLE students ENABLE KEYS */; -- -- Definition of table `w' at line 1016 Line 46, column 1

    Read the article

  • how to handle JavaScript objects with colons in key names?

    - by Ethan
    There is a syntax error in the following code: <!DOCTYPE html> <html> <body> Hello World! <script type="text/javascript"> var obj = {'a:b': '1'}; alert(obj.a:b); // syntax error </script> </body> </html> So how to handle JavaScript objects with colons in key names? I have to do this because I need to handle a feed in jsonp format from a remote server which I do not have control over, and there are colons in the key names of the returned jsonp (because the jsonp is converted from XML with namespaces in tags).

    Read the article

  • Pass off execution to different/specific thread in Java

    - by Mike
    I have about 4 threads. One thread keeps checking some data that the other thread is updating. The others are doing some processing in the background. All have been started at this point. My question is when the checking thread sees that the data has not been updated yet I currently sleep for a little bit but is there any way for me to tell the system to back to executing the thread that does the updating? That or is there any way I can put something like a listener on the data(a String) and once its updated an event will fire that will do what it needs to do? I tried using yield() and it seemed to just keep returning to the thread I called yield() from. Thanks

    Read the article

  • How to change word recognition in vim spell?

    - by David
    I like that vim 7.0 supports spell checking via :set spell, and I like that it by default only checks comments and text strings in my C code. But I wanted to find a way to change the behavior so that vim will know that when I write words containing underscores, I don't want that word spell checked. The problem is that I often will refer to variable or function names in my comments, and so right now vim thinks that each piece of text that isn't a complete correct word is a spelling error. Eg. /* The variable proj_abc_ptr is used in function do_func_stuff' */ Most of the time, the pieces seperated by underscores are complete words, but other times they are abbreviations that I would prefer not to add to a word list. Is there any global way to tell vim to include _'s as part of the word when spell checking?

    Read the article

  • MySQL Check if table exists error

    - by Max van Heiningen
    I'm trying to check if a table already exists, however I can't get this working. IF EXISTS (SELECT 1 FROM sysobjects WHERE xtype='u' AND name='tablename') SELECT 'table already exists.' ELSE BEGIN CREATE TABLE Week_( id INT(10)AUTO_INCREMENT PRIMARY KEY (id), ... ...) END; My error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS (SELECT 1 FROM sysobjects WHERE xtype='u' AND name' at line 1 Can someone help me with this? Thanks in advance

    Read the article

  • Want to 'sandbox' user form submitted HTML

    - by pmmenneg
    Hi all. I have a user form with a textarea that allows users to submit html formatted data. The html itself is limited by PHP strip_tags, but of course that does no completion checking etc. My basic problem is that should a user leave a tag unclosed, such as the tag, then all the content following that, including page content that follows that is 'outside' the user content display area, could now be malformed. Checking for proper tag completion is one solution I will look at, but ideally I'd like to firewall the user htmlified content away from the rest of the site somehow. Any suggestions on the best approach? Thanks!

    Read the article

  • An array of structures in C...

    - by 00010000
    For the life of me I can't figure out the proper syntax for creating an array of structures in C. I tried this: struct foo { int x; int y; } foo[][] = { { { 1, 2 }, { 4, 5 }, { -1, -1 } }, { { 55, 44 } { 100, 200 }, } }; So for example foo[1][0].x == 100, foo[0][1].y == 5, etc. But GCC spits out a lot of errors. If anyone could provide the proper syntax that'd be great. EDIT: Okay, I tried this: struct foo { const char *x; int y; }; struct foo bar[2][] = { { { "A", 1 }, { "B", 2 }, { NULL, -1 }, }, { { "AA", 11 }, { "BB", 22 }, { NULL, -1 }, }, { { "ZZ", 11 }, { "YY", 22 }, { NULL, -1 }, }, { { "XX", 11 }, { "UU", 22 }, { NULL, -1 }, }, }; But GCC gives me "elements of array bar have incomplete type" and "excess elements in array initializer".

    Read the article

  • Can't figure out what's wrong with my php/sql statement

    - by Olegious
    So this is probably a dumb beginner question, but I've been looking at it and can't figure it out. A bit of background: just practicing making a web app, a form on page 1 takes in some values from the user, posts them to the next page which contains the code to connect to the DB and populate the relevant tables. I establish the DB connection successfully, here's the code that contains the query: $conn->query("SET NAMES 'utf9'"); $query_str = "INSERT INTO 'qa'.'users' ('id', 'user_name','password' ,'email' ,'dob' ,'sx') VALUES (NULL, $username, $password, $email, $dob, $sx);"; $result = @$conn->query($query_str); Here's the error that is returned:Insert query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''qa'.'users' ('id', 'user_name' ,'password' ,'email' ,'dob' ,'s' at line 1 Thanks in advance!

    Read the article

  • Bash, Concatenating 2 strings to reference a 3rd variable

    - by Im Fine
    I have a bash script I am having some issues with concatenating 2 variables to call a 3rd. Here is a simplification of the script, but the syntax is eluding me after reading the docs. server_list_all="server1 server2 server3"; var1 = "server"; var2 = "all"; echo $(($var1_list_$var2)); This is about as close as I get to the right answer, it acknowledges the string and tosses an error on tokenization. syntax error in expression (error token is "server1 server2 server3.... Not really seeing anything in the docs for this, but it should be doable. EDIT: Cleaned up a bit

    Read the article

  • Why my query is not working?

    - by Poma
    my website has PHP command: mysql_query("SELECT * FROM users WHERE id=" . $_GET["id"]) or die(mysql_error()); When I enter URL http://example.com/index.php?id=1;%20UPDATE%20users%20SET%20password=123%20WHERE%20id=1 I get following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE users SET password=abc WHERE id=1' at line 1 But in phpmyamin query executes successfully. What's wrong here? Why it doesn't execute in browser?

    Read the article

< Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >