Search Results

Search found 13794 results on 552 pages for 'variable scope'.

Page 47/552 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • Execute query stored in variable in a very specific way

    - by niao
    Greetings, I have a problem as follows: I have an SQL variable declared: DECLARE @myVariable nvarchar(max) a third party library set a value for this variable. To simplify, lets say that the value is as follows: SET @myVariable = 'Select ROWGUID from MySampleTable' Now, I want to execute the following query: SELECT ROWGUID FROM myTable WHERE ROWGUID in (exec sp_executesql @myVariable ) However, the above statement does not work because it returns an error telling me that I can't execute stored procedure in that way. I made a workaround and this is what I wrote: create table #temptable (ID uniqueidentifier null) if(@myVariable is not null AND @myVariable !='') insert into #temptable exec sp_executesql @myVariable SELECT ROWGUID FROM myTable WHERE ROWGUID in (select * from #temptable) DROP TABLE #temptable This works fine.However I don't think it is a good idea to use temporary table. How can I achieve the same result without necessity of creating temporary tables? I am using SQL SERVER 2005

    Read the article

  • Objective-C: Cannot Change Value of Instance Variable Inside a Function

    - by user262325
    Hello everyone, I cannot change the value of an instance variable inside a function. I have defined a class: // info.h #import <Foundation/Foundation.h> @interface NSMyObject : NSObject { NSInteger i; } -(void) setI:(NSInteger)v; @end #import "info.h" @implementation NSMyObject -(void) setI:(NSInteger)v ; { i=v; } - (void)dealloc { [super dealloc]; } @end I call a function 'myFunction' with parameter temObj which is a NSMyObject instance. myFunction(temObj);//temObj is NSMyObject In the function, I can change the value of the instance variable of parameter obj. -(void)myFunction:(NSMyObject*) obj; { [obj setI:0]; } ... expecting this to change the content of temObj. But when I check the results of operation on obj in function myFunction the value of temObj.i has not changed. Welcome any comment Thanks

    Read the article

  • ruby confusing -- local variable or instance_method ?

    - by boblu
    I have the following program. module C def self.included(base) base.extend(ClassMethods) end module ClassMethods def test_for class_eval <<-DEFINECLASSMETHODS def self.my_method(param_a) puts "SELF is: #{self.inspect}" puts param_a puts "#{param_a}" end DEFINECLASSMETHODS end end end class A include C end class B < A test_for end when I run B.new.my_method("aaa"), I got this error NameError: undefined local variable or method `param_a' for B:Class I am quite confused. I define param_a as a local variable in class method my_method, puts param_a runs good, and will output the "aaa". however, puts "#{param_a}" output that error. why? Can anyone explain this?

    Read the article

  • Random password variable disappears

    - by snaken
    Hi, I'm using the following to generate a random password in a shell script: DBPASS=</dev/urandom tr -dc A-Za-z0-9| (head -c $1 > /dev/null 2>&1 || head -c 8) When i run this in a file on its own like this: #!/bin/sh DBPASS=</dev/urandom tr -dc A-Za-z0-9| (head -c $1 > /dev/null 2>&1 || head -c 8) echo $DBPASS A password is echoed. When i incorporate it into a larger script though the variable never seems to get created for some reason, so for example this doesn't work: DBPASS=</dev/urandom tr -dc A-Za-z0-9| (head -c $1 > /dev/null 2>&1 || head -c 8) sed -i s/oldpass/$DBPASS/ mysql_connect.php If i manually set the variable though everything is fine.. can anyone see why?

    Read the article

  • How to set PATH to another variable value with spaces in Windows batch file

    - by Evgeny
    I've got a Windows batch script issue that I'm bashing my head against (no pun intended). The problematic script looks like this: if defined _OLD_VIRTUAL_PATH ( set PATH=%_OLD_VIRTUAL_PATH% ) When I run it and _OLD_VIRTUAL_PATH is set I get: \Microsoft was unexpected at this time. _OLD_VIRTUAL_PATH is a variable that was originally set from PATH and it contains spaces - I'm pretty sure that's the problem. But what's the solution? It runs successfully if I enclose it in quotes, but I don't think the entire value of the PATH variable is supposed to be in quotes.

    Read the article

  • Template variable in ASP.NET

    - by williamrichards
    Hi, I have to add a Page's variable into a ItemTemplate but dont know how. For example: <rad:RadMenuItem ID="f" runat="server" Text="Products"> <ItemTemplate> <div class="pitem"><%= MyText %></div> </ItemTemplate> </rad:RadMenuItem> The MyText variable does exist in the context and has value but the text does not show up Another question: How can I add MyText to the ASP.NET page like the following? <asp:Button Text="<%=MyText%>" .../>

    Read the article

  • Flex Application for PlayBook Text Input Variable

    - by user568128
    I know this is probably a very simple question, but can someone please walk me through how to take what a user inputs into a s:TextInput and use that as a variable in a JSON data request? Basically, I want to have a user enter a search term, like "math" and then have that placed into a variable so I can use it in a JSON request. Something like public var q:String, except that my search box (and hence user input) is on another "view" of the application. I've just started with Flex Mobile applications and I might be way out of my league. Does anyone know how to do this?

    Read the article

  • Local variable and Try/Catch

    - by 3D-kreativ
    I get an error, a red line below the variable intAge in the if-statement in the code. It says the variable is local, but how could it be local when it is declared in the beginning of the code? Does it have to do with the Try/Catch part? The reason why my code looks like it does, is just beacuse I have to use a Try/Catch in the code for this task. Preciate some suggestions to solve this in a similiar and correct way? Thanks! int intAge; try { intAge = int.Parse(age); } catch (Exception) { MessageBox.Show("Enter an age in numbers!","Error!"); } finally { } // Check input if (intAge < 1) { inputOk = false; errorMessage = "Please enter 1 or higher!"; }

    Read the article

  • Passing a variable that can be updated

    - by Rob Bonner
    This seems like a simple thing, but can't get it to work. I pass a variable into a UIViewController thourgh a standard property: [aViewController setProposedDate:proposedWorkLog.entryDate]; which is retained by the controller, and possible changed. I have verified that in the controller, the data is modified. But, after it is popped off the stack and I look in the calling view, the data has not been updated. Is there a way to pass this variable and have it retain the new value, or a way to pass back a response from a closing view controller? Thanks!

    Read the article

  • how to take input for uint32_t variable

    - by sksingh73
    i have declared a variable as uint32_t num; when i take input for this variable i.e cinnum; cout< when i run this program, i gives num value as 12345678, it works fine & give cout. but when i give input as 1234abcd. it creates problem & displays only 1234. please suggest solution to resolve this problem.

    Read the article

  • woocommerce show attribute description when selecting a variable

    - by user2916995
    I'm trying to figure out a way to display custom text based on the users selection of the variable product. The attribute is 'pricing' and the tag is deposit - which I've added a text description to when adding the attribute. So I'm trying to make this text appear when the user selects 'deposit' But the code I'm using in 'content-single-product.php' is displaying the text all the time no matter what variable is selected or not. <?php $my_taxonomy = 'pa_pricing'; $terms = wp_get_post_terms( $post->ID, $my_taxonomy ); echo term_description($terms[0]->term_id, $my_taxonomy); ?> I only want the text to be displayed after the user has selected pricing 'deposit' Can someone help me with this?

    Read the article

  • [Bash] Save part of matching pattern to variable

    - by Ben
    I want to extract a substring matching a pattern and save it to a file. An example string: Apr 12 19:24:17 PC_NMG kernel: sd 11:0:0:0: [sdf] Attached SCSI removable disk I want to extract the part between the brackets, in this case []. I tried to do something like grep -e '[$subtext]' to save the text in the brackets to a variable. Of course it doesn't work, but I am looking for a way similar to this. It would be very elegant to include a variable in a regex like this. What can I do best? Thanks!

    Read the article

  • PHP and Javascript: Getting file contents with Javascript variable

    - by celliott1997
    Could someone help me to understand why this isn't working? var uname = "<?php echo strtolower($_GET['un']) ?>"; var source = "<?php echo file_get_contents('accounts/"+uname+"') ?>"; console.log(source); I've been trying for a while to get this working and it just doesn't seem to. Before I added in the source variable, it was working fine and displayed the un variable on the page. Thanks.

    Read the article

  • Capture variable assignments in a Perl eval

    - by Bruce
    I would like to be able to capture variable assignments from a Perl eval. That is, to determine what variable names have been assigned to within the code and extract their value. For example if I run: eval '$foo=42; $bar=3.14;' The result of the eval is 3.14 (the last value evaluated), but I would also like to be able to determine the names "$foo" and "$bar" and their values (without knowing the names in advance). I have read up on a couple of ways of inserting variables into the eval block, through Safe and Eval::Context, but not yet any way of extracting them. I am more familiar with Python's eval/exec which have built in support for this.

    Read the article

  • asp.net C# variable as Image1.ImageUrl property

    - by ModS
    I would like to Click "buttonImage1" and have that store "photos/Image1.jpg" into a var called Photo. then have ButtonImage2.ImageUrl = (Photo). I am using an UpdatePanel to refresh the area with the images so the only problem is actually setting the variable correctly and then using it correctly. Reworded: how can I store a path to an image in a variable then set it correctly as a image's URL path? protected void Button2_Click(object sender, ImageClickEventArgs e) { Evt = ("~/events/ev2.jpg"); } protected void Image2_Click(object sender, ImageClickEventArgs e) { Image1.ImageUrl = (Evt); }

    Read the article

  • Save data from array in variable

    - by marcin_poland
    SOLVED! I`m trying save data from array in variable. I have in controller: $data = array('upload_data' => $this->upload->data()); and I know that in this array are data about uploading file. One with this date is "file_name", and I want to save this value in controller at variable. I try with: $image_name= $data['file_name']; But this not working. I use CodeIginter 2.1.3 framework. Good solution is: $data['upload_data']['file_name']; Thanks for help!

    Read the article

  • xsl:variable xsl:copy-of select

    - by user1901345
    I have the following XML: Picture 1 Picture 2 Picture 3 While this XSL does what is expected (output the attr of the first picture): It seems to be not possible to do the same inside the variable declaration using xsl:copy-of: Curious: If I just select "$FirstPicture" instead of "$FirstPicture/@attr" in the second example, it outputs the text node of Picture 1 as expected... Before you all suggest me to rewrite the code: This is just a simplified test, my real aim is to use a named template to select a node into the variable FirstPicture and reuse it for further selections. I hope someone could help me to understand the behavior or could suggest me a proper way to select a node with code which could be easily reused (the decission which node is the first one is complex in my real application). Thanks.

    Read the article

  • php define variable inside str_replace array

    - by john
    I have a template system, that replaces text such as {HEADER} with the appropriate content. I use an array like this, that replaces the key with the value using str_replace. $array = array("HEADER","This is the header"); foreach($array as $var => $content) { $template = str_replace("{" . strtoupper($var). "}", $content,$template); } Now im trying to use a defined variable like this: define("NAME","Site Name"); Inside the value for the header. So I want the defined variable to be inside the array which gets replaced so it would look like this, but it doesn't work. $array = array("HEADER","Welcome to ".NAME."'s website!"); Any ideas? tell me if im not clear

    Read the article

  • Checking variable from a different class in C#

    - by Josh
    Greetings- I have 2 classes. One is called "Programs" and the other is called "Logs". The class called Programs has public const string m_sEnviron = ""; near the top and I need to check what the m_sEnviron variable is set to through my class called Logs. The variable m_sEnviron will get set from a scheduler called Tidal so how can I check its value from a different class. If this is not the best to do this then please let me know what the better ways are. Thanks in advance. Regards,

    Read the article

  • PHP Losing variable data

    - by Conor B
    Hi, I'm having an issue with PHP losing data in a variable. There is quite a bit of data in the variable, because it basically contains a binary file, but I'm wondering if this is cause for it to completely lose it's information. Looking at a snippet from my code which is used to deal with email attachments: var_dump($data) if (array_key_exists('filename', $params) || array_key_exists('name', $params)) { var_dump($data) ... } The first var_dump gives the desired output of the file: "string(283155) " --Apple-Mail-5-930065543 ... etc while the second gives an output of: string(0) "" ... string(0) "" Any idea why this is happening? Does PHP just drop data in variables if they are really large? (I didn't think so, as I've never had this problem before) If so, any workaround? Thanks!

    Read the article

  • Select value from database and store into a temporary variable

    - by user1616230
    I want to select a stored value from database and then put it into a temporary variable. For example, I have a column called category, one value under it is m, so I want to select this m value from the database, let's say from a table of a database called user_info. Then I want to put it into a variable, let's name it $res. After that, I want to do some condition stuff, such as if $res=="m", Can anyone help me write a simple structure here? Here is the code: <?php $sql = "Select category FROM user_info WHERE user_name = '" .$_SESSION['username']."' and password = '".$_SESSION['password']."'"; $res = mysql_query($sql); if($res == "a"){ include('MPIncomeStrategy.php'); } if($res == "b"){ include('MPIncomeStrategy.php'); } But it seems that the code is not able to detect $res =="category value in database". Did I just use the wrong way to store the category value?

    Read the article

  • Vim: `cd` to path stored in variable

    - by tsyu80
    I'm pretty new to vim, and I'm having a hard time understanding some subtleties with vim scripting. Specifically, I'm having trouble working with commands that expect an unquoted-string (is there a name for this?). For example cd some/unquoted/string/path The problem is that I'd like to pass a variable, but calling let pathname = 'some/path' cd pathname will try to change the current directory to 'pathname' instead of 'some/path'. One way around this is to use let cmd = 'cd ' . pathname execute cmd but this seems a bit roundabout. This StackOverflow question actually uses cd with a variable, but it doesn't work on my system ("a:path" is treated as the path as described above). I'm using cd as a specific example, but this behavior isn't unique to cd; for example, the edit command also behaves this way. (Is there a name for this type of command?)

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >