Search Results

Search found 12457 results on 499 pages for 'variable assignment'.

Page 8/499 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Update table variable with function

    - by Joris
    I got a table variable @RQ, I want it updated using a table-valued function. Now, I think I do the update wrong, because my function works... The function: ALTER FUNCTION [dbo].[usf_GetRecursiveFoobar] ( @para int, @para datetime, @para varchar(30) ) RETURNS @ReQ TABLE ( Onekey int, Studnr nvarchar(10), Stud int, Description nvarchar(32), ECTSGot decimal(5,2), SBUGot decimal(5,0), ECTSmax decimal(5,2), SBUmax decimal(5,0), IsFree bit, IsGot int, DateGot nvarchar(10), lvl int, path varchar(max) ) AS BEGIN; WITH RQ AS ( --RECURSIVE QUERY ) INSERT @ReQ SELECT RQ.Onekey, RQ.Studnr, RQ.Stud, RQ.Description, RQ.ECTSGot, RQ.SBUGot, RQ.ECTSmax, RQ.SBUmax, RQ.IsFree, RQ.IsGot, RQ.DatumGot, RQ.lvl, RQ.path FROM RQ RETURN END Now, when I run a simple query: DECLARE @ReQ TABLE ( OnderwijsEenheid_key int, StudentnummerHSA nvarchar(10), Student_key int, Omschrijving nvarchar(32), ECTSbehaald decimal(5,2), SBUbehaald decimal(5,0), ECTSmax decimal(5,2), SBUmax decimal(5,0), IsVrijstelling bit, IsBehaald int, DatumBehaald nvarchar(10), lvl int, path varchar(max) ) INSERT INTO @ReQ SELECT * FROM usf_GetRecursiveFoobar(@para1, @para2, @para3) I got error: Msg 8152, Level 16, State 13, Line 20 String or binary data would be truncated. The statement has been terminated. Why? What to do about it?

    Read the article

  • C++ arrays as parameters, EDIT: now includes variable scoping

    - by awshepard
    Alright, I'm guessing this is an easy question, so I'll take the knocks, but I'm not finding what I need on google or SO. I'd like to create an array in one place, and populate it inside a different function. I define a function: void someFunction(double results[]) { for (int i = 0; i<100; ++i) { for (int n = 0; n<16; ++n) //note this iteration limit { results[n] += i * n; } } } That's an approximation to what my code is doing, but regardless, shouldn't be running into any overflow or out of bounds issues or anything. I generate an array: double result[16]; for(int i = 0; i<16; i++) { result[i] = -1; } then I want to pass it to someFunction someFunction(result); When I set breakpoints and step through the code, upon entering someFunction, results is set to the same address as result, and the value there is -1.000000 as expected. However, when I start iterating through the loop, results[n] doesn't seem to resolve to *(results+n) or *(results+n*sizeof(double)), it just seems to resolve to *(results). What I end up with is that instead of populating my result array, I just get one value. What am I doing wrong? EDIT Oh fun, I have a typo: it wasn't void someFunction(double results[]). It was: void someFunction(double result[])... So perhaps this is turning into a scoping question. If my double result[16] array is defined in a main.cpp, and someFunction is defined in a Utils.h file that's included by the main.cpp, does the result variable in someFunction then wreak havoc on the result array in main?

    Read the article

  • unit testing variable state explicit tests in dynamically typed languages

    - by kris welsh
    I have heard that a desirable quality of unit tests is that they test for each scenario independently. I realised whilst writing tests today that when you compare a variable with another value in a statement like: assertEquals("foo", otherObject.stringFoo); You are really testing three things: The variable you are testing exists and is within scope. The variable you are testing is the expected type. The variable you are testing's value is what you expect it to be. Which to me raises the question of whether you should test for each of these implicitly so that a test fail would occur on the specific line that tests for that problem: assertTrue(stringFoo); assertTrue(stringFoo.typeOf() == "String"); assertEquals("foo", otherObject.stringFoo); For example if the variable was an integer instead of a string the test case failure would be on line 2 which would give you more feedback on what went wrong. Should you test for this kind of thing explicitly or am i overthinking this?

    Read the article

  • How to ensure that a member variable is initialized before calling a class method

    - by Omkar Ekbote
    There's a class with a parametrized constructor that initializes a member variable. All public methods of the class then use this member variable to do something. I want to ensure that the caller always creates an object using the parametrized constructor (there is also a setter for this member variable) and then call that object's methods. In essence, it should be impossible for the caller to call any method without setting a value to the member variable (either by using the parametrized constructor or the setter). Currently, a caller can simply make an object using the default constructor and then call that object's method - I want to avoid checking whether or not the member variable is set in each and every one of the 20-odd methods of the class (and throw an exception if it is not). Though a runtime solution is acceptable (better than the one I mentioned above); a compile-time solution is preferable so that any developer will not be allowed to make that mistake and then waste hours debuggging it!

    Read the article

  • Assign variable with variable in function

    - by freakazo
    Let's say we have def Foo(Bar=0,Song=0): print(Bar) print(Song) And I want to assign any one of the two parameters in the function with the variable sing and SongVal: Sing = Song SongVal = 2 So that it can be run like: Foo(Sing=SongVal) Where Sing would assign the Song parameter to the SongVal which is 2. The result should be printed like so: 0 2 So should I rewrite my function or is it possible to do it the way I want to? (With the code above you get an error saying Foo has no parameter Sing. Which I understand why, any way to overcome this without rewriting the function too much? Thanks in advance!

    Read the article

  • JS Variable inside another variable

    - by Tusk
    I have a function that would use other variables, depending on what has been passed. Like this = ActionBar(slot) slot contains "one". and I would like to create a call inside that like object.slot.name but it should convert it before hand to make the command look like object.one.name. Is there a way to do this in javascript/jquery? I remember vaguely that some other language does this as {slot} or something like that. Sorry if this question was already asked, I've checked google and stackoverflow too, but didn't find an answer. Also I'd like to know what's the proper programming term for this kind of variable passing? Edited it cause of misunderstandings. I'm looking into OOP js, so object is an object, one is an object, and name is an attribute, but when passing I'm passing "one" as a string to the function. Tried eval, it doesn't work while dotted with an object.

    Read the article

  • Help needed with Javascript Variable Scope / OOP and Call Back Functions

    - by gargantaun
    I think this issue goes beyond typical variable scope and closure stuff, or maybe I'm an idiot. Here goes anyway... I'm creating a bunch of objects on the fly in a jQuery plugin. The object look something like this function WedgePath(canvas){ this.targetCanvas = canvas; this.label; this.logLabel = function(){ console.log(this.label) } } the jQuery plugin looks something like this (function($) { $.fn.myPlugin = function() { return $(this).each(function() { // Create Wedge Objects for(var i = 1; i <= 30; i++){ var newWedge = new WedgePath(canvas); newWedge.label = "my_wedge_"+i; globalFunction(i, newWedge]); } }); } })(jQuery); So... the plugin creates a bunch of wedgeObjects, then calls 'globalFunction' for each one, passing in the latest WedgePath instance. Global function looks like this. function globalFunction(indicator_id, pWedge){ var targetWedge = pWedge; targetWedge.logLabel(); } What happens next is that the console logs each wedges label correctly. However, I need a bit more complexity inside globalFunction. So it actually looks like this... function globalFunction(indicator_id, pWedge){ var targetWedge = pWedge; someSql = "SELECT * FROM myTable WHERE id = ?"; dbInterface.executeSql(someSql, [indicator_id], function(transaction, result){ targetWedge.logLabel(); }) } There's a lot going on here so i'll explain. I'm using client side database storage (WebSQL i call it). 'dbInterface' an instance of a simple javascript object I created which handles the basics of interacting with a client side database [shown at the end of this question]. the executeSql method takes up to 4 arguments The SQL String an optional arguments array an optional onSuccess handler an optional onError handler (not used in this example) What I need to happen is: When the WebSQL query has completed, it takes some of that data and manipulates some attribute of a particular wedge. But, when I call 'logLabel' on an instance of WedgePath inside the onSuccess handler, I get the label of the very last instance of WedgePath that was created way back in the plugin code. Now I suspect that the problem lies in the var newWedge = new WedgePath(canvas); line. So I tried pushing each newWedge into an array, which I thought would prevent that line from replacing or overwriting the WedgePath instance at every iteration... wedgeArray = []; // Inside the plugin... for(var i = 1; i <= 30; i++){ var newWedge = new WedgePath(canvas); newWedge.label = "my_wedge_"+i; wedgeArray.push(newWedge); } for(var i = 0; i < wedgeArray.length; i++){ wedgeArray[i].logLabel() } But again, I get the last instance of WedgePath to be created. This is driving me nuts. I apologise for the length of the question but I wanted to be as clear as possible. END ============================================================== Also, here's the code for dbInterface object should it be relevant. function DatabaseInterface(db){ var DB = db; this.sql = function(sql, arr, pSuccessHandler, pErrorHandler){ successHandler = (pSuccessHandler) ? pSuccessHandler : this.defaultSuccessHandler; errorHandler = (pErrorHandler) ? pErrorHandler : this.defaultErrorHandler; DB.transaction(function(tx){ if(!arr || arr.length == 0){ tx.executeSql(sql, [], successHandler, errorHandler); }else{ tx.executeSql(sql,arr, successHandler, errorHandler) } }); } // ---------------------------------------------------------------- // A Default Error Handler // ---------------------------------------------------------------- this.defaultErrorHandler = function(transaction, error){ // error.message is a human-readable string. // error.code is a numeric error code console.log('WebSQL Error: '+error.message+' (Code '+error.code+')'); // Handle errors here var we_think_this_error_is_fatal = true; if (we_think_this_error_is_fatal) return true; return false; } // ---------------------------------------------------------------- // A Default Success Handler // This doesn't do anything except log a success message // ---------------------------------------------------------------- this.defaultSuccessHandler = function(transaction, results) { console.log("WebSQL Success. Default success handler. No action taken."); } }

    Read the article

  • How do I use a variable within an extended class public variable

    - by Gerry Humphrey
    Have a class that I am using, I am overriding variables in the class to change them to what values I need, but I also not sure if or how to handle an issue. I need to add a key that is generated to each of this URLs before the class calls them. I cannot modify the class file itself. use Theme/Ride class ETicket extends Ride { public $key='US20120303'; // Not in original class public $accessURL1 = 'http://domain.com/keycheck.php?key='.$key; public $accessURL2 = 'http://domain.com/keycheck.php?key='.$key; } I understand that you cannot use a variable in the setting of the public class variables. Just not sure what would be the way to actually do something like this in the proper format. My OOP skills are weak. I admit it. So if someone has a suggestion on where I could read up on it and get a clue, it would be appreciated as well. I guess I need OOP for Dummies. =/

    Read the article

  • how to link a c++ object to a local variable in Lua

    - by MahanGM
    I'm completing my scripting interface with Lua, but recently I've stuck at some point. I have several functions for my Entitiy events like Update(). I have a function called create_entitiy() which instantiate a new entity from a given entity index: function Update() local bullet = create_entity(0, 0, "obj_bullet") end create_entity returns a table which is the properties of the created entity. Now how can I make a connection between bullet variable and my newly created object? Right now for previously added objects to the scene, I simply set a global table for each of them and then after every call to Update(), I go through registered names to find object tables and perform new changes. Like the one below: function Update() if keyboard_key_press(vk_right) then obj_player.x += 3 end I can get obj_player table because I know its name from C++, plus I can get it as a global table and simply reach for the first instance named obj_player. Is there any solution for me to make bullet variable act like this? I was thinking to get all local variables in Update() function and check for every one to see if is it table and it has an unique field attached to it like id, this way I can determine that this is an object table and do the rest of the process. By the way, is this interface going to work easier with luaBind if I implement it? Bottom line: How can I make a local variable in Lua that receives a table from create_entity function and track that local variable to capture it from C++. e. g. function Update() local bullet = create_entity(0, 0, "obj_bullet") bullet.x = 10 <== Commit a change in table end Now I want to get variable bullet from C++. And it's not just this variable, there might be a ton of these local variables with different names.

    Read the article

  • Mixed declarations and code in open source projects?

    - by Eduardo
    Why is still C99 mixed declarations and code not used in open source C projects like the Linux kernel or GNOME? I really like mixed declarations and code since it makes the code more readable and prevents hard to see bugs by restricting the scope of the variables to the narrowest possible. This is recommended by Google for C++. For example, Linux requires at least GCC 3.2 and GCC 3.1 has support for C99 mixed declarations and code

    Read the article

  • C99 mixed declarations and code in open source projects?

    - by Eduardo
    Why is still C99 mixed declarations and code not used in open source C projects like the Linux kernel or GNOME? I really like mixed declarations and code since it makes the code more readable and prevents hard to see bugs by restricting the scope of the variables to the narrowest possible. This is recommended by Google for C++. For example, Linux requires at least GCC 3.2 and GCC 3.1 has support for C99 mixed declarations and code

    Read the article

  • Oracle HRMS API – Update Employee Assignment

    - by PRajkumar
    To Update Supervisor, Manager Flag, Bargaining Unit, Labour Union Member Flag, Gre, Time Card, Work Schedule, Normal Hours, Frequency, Time Normal Finish, Time Normal Start, Default Code Combination, Set of Books Id API -- hr_assignment_api.update_emp_asg   To Update Grade, Location, Job, Payroll, Organization, Employee Category, People Group API -- hr_assignment_api.update_emp_asg_criteria   Example --   DECLARE    -- Local Variables    -- -----------------------    lc_dt_ud_mode           VARCHAR2(100)    := NULL;    ln_assignment_id       NUMBER                  := 33561;    ln_supervisor_id        NUMBER                  := 2;    ln_object_number       NUMBER                  := 1;    ln_people_group_id  NUMBER                  := 1;      -- Out Variables for Find Date Track Mode API    -- -----------------------------------------------------------------    lb_correction                           BOOLEAN;    lb_update                                 BOOLEAN;    lb_update_override              BOOLEAN;    lb_update_change_insert   BOOLEAN;       -- Out Variables for Update Employee Assignment API    -- ----------------------------------------------------------------------------    ln_soft_coding_keyflex_id       HR_SOFT_CODING_KEYFLEX.SOFT_CODING_KEYFLEX_ID%TYPE;    lc_concatenated_segments       VARCHAR2(2000);    ln_comment_id                             PER_ALL_ASSIGNMENTS_F.COMMENT_ID%TYPE;    lb_no_managers_warning        BOOLEAN;  -- Out Variables for Update Employee Assgment Criteria  -- -------------------------------------------------------------------------------  ln_special_ceiling_step_id                    PER_ALL_ASSIGNMENTS_F.SPECIAL_CEILING_STEP_ID%TYPE;  lc_group_name                                          VARCHAR2(30);  ld_effective_start_date                             PER_ALL_ASSIGNMENTS_F.EFFECTIVE_START_DATE%TYPE;  ld_effective_end_date                              PER_ALL_ASSIGNMENTS_F.EFFECTIVE_END_DATE%TYPE;  lb_org_now_no_manager_warning   BOOLEAN;  lb_other_manager_warning                  BOOLEAN;  lb_spp_delete_warning                          BOOLEAN;  lc_entries_changed_warning                VARCHAR2(30);  lb_tax_district_changed_warn             BOOLEAN;   BEGIN    -- Find Date Track Mode    -- --------------------------------    dt_api.find_dt_upd_modes    (    p_effective_date                  => TO_DATE('12-JUN-2011'),         p_base_table_name            => 'PER_ALL_ASSIGNMENTS_F',         p_base_key_column           => 'ASSIGNMENT_ID',         p_base_key_value               => ln_assignment_id,          -- Output data elements          -- --------------------------------          p_correction                          => lb_correction,          p_update                                => lb_update,          p_update_override              => lb_update_override,          p_update_change_insert   => lb_update_change_insert      );      IF ( lb_update_override = TRUE OR lb_update_change_insert = TRUE )    THEN        -- UPDATE_OVERRIDE        -- ---------------------------------        lc_dt_ud_mode := 'UPDATE_OVERRIDE';    END IF;     IF ( lb_correction = TRUE )   THEN       -- CORRECTION       -- ----------------------      lc_dt_ud_mode := 'CORRECTION';   END IF;     IF ( lb_update = TRUE )   THEN       -- UPDATE       -- --------------       lc_dt_ud_mode := 'UPDATE';    END IF;     -- Update Employee Assignment   -- ---------------------------------------------  hr_assignment_api.update_emp_asg  ( -- Input data elements   -- ------------------------------   p_effective_date                              => TO_DATE('12-JUN-2011'),   p_datetrack_update_mode         => lc_dt_ud_mode,   p_assignment_id                            => ln_assignment_id,   p_supervisor_id                              => NULL,   p_change_reason                           => NULL,   p_manager_flag                              => 'N',   p_bargaining_unit_code              => NULL,   p_labour_union_member_flag   => NULL,   p_segment1                                       => 204,   p_segment3                                       => 'N',   p_normal_hours                              => 10,   p_frequency                                       => 'W',   -- Output data elements   -- -------------------------------   p_object_version_number             => ln_object_number,   p_soft_coding_keyflex_id              => ln_soft_coding_keyflex_id,   p_concatenated_segments             => lc_concatenated_segments,   p_comment_id                                   => ln_comment_id,   p_effective_start_date                      => ld_effective_start_date,   p_effective_end_date                        => ld_effective_end_date,   p_no_managers_warning               => lb_no_managers_warning,   p_other_manager_warning            => lb_other_manager_warning  );    -- Find Date Track Mode for Second API   -- ------------------------------------------------------   dt_api.find_dt_upd_modes   (  p_effective_date                   => TO_DATE('12-JUN-2011'),      p_base_table_name            => 'PER_ALL_ASSIGNMENTS_F',      p_base_key_column           => 'ASSIGNMENT_ID',      p_base_key_value               => ln_assignment_id,      -- Output data elements      -- -------------------------------      p_correction                           => lb_correction,      p_update                                 => lb_update,      p_update_override               => lb_update_override,      p_update_change_insert    => lb_update_change_insert   );     IF ( lb_update_override = TRUE OR lb_update_change_insert = TRUE )   THEN     -- UPDATE_OVERRIDE     -- --------------------------------     lc_dt_ud_mode := 'UPDATE_OVERRIDE';   END IF;      IF ( lb_correction = TRUE )    THEN      -- CORRECTION      -- ----------------------      lc_dt_ud_mode := 'CORRECTION';   END IF;      IF ( lb_update = TRUE )    THEN      -- UPDATE      -- --------------      lc_dt_ud_mode := 'UPDATE';    END IF;    -- Update Employee Assgment Criteria  -- -----------------------------------------------------  hr_assignment_api.update_emp_asg_criteria  ( -- Input data elements   -- ------------------------------   p_effective_date                                   => TO_DATE('12-JUN-2011'),   p_datetrack_update_mode               => lc_dt_ud_mode,   p_assignment_id                                 => ln_assignment_id,   p_location_id                                        => 204,   p_grade_id                                             => 29,   p_job_id                                                  => 16,   p_payroll_id                                          => 52,   p_organization_id                               => 239,   p_employment_category                    => 'FR',   -- Output data elements   -- -------------------------------   p_people_group_id                              => ln_people_group_id,   p_object_version_number                   => ln_object_number,   p_special_ceiling_step_id                  => ln_special_ceiling_step_id,   p_group_name                                        => lc_group_name,   p_effective_start_date                           => ld_effective_start_date,   p_effective_end_date                             => ld_effective_end_date,   p_org_now_no_manager_warning  => lb_org_now_no_manager_warning,   p_other_manager_warning                 => lb_other_manager_warning,   p_spp_delete_warning                         => lb_spp_delete_warning,   p_entries_changed_warning              => lc_entries_changed_warning,   p_tax_district_changed_warning     => lb_tax_district_changed_warn  );    COMMIT; EXCEPTION          WHEN OTHERS THEN                       ROLLBACK;                       dbms_output.put_line(SQLERRM); END; / SHOW ERR;    

    Read the article

  • Move constructor and assignment operator: why no default for derived classes?

    - by doublep
    Why there is default move constructor or assignment operator not created for derived classes? To demonstrate what I mean; having this setup code: #include <utility> struct A { A () { } A (A&&) { throw 0; } A& operator= (A&&) { throw 0; } }; struct B : A { }; either of the following lines throws: A x (std::move (A ()); A x; x = A (); but neither of the following does: B x (std::move (B ()); B x; x = B (); In case it matters, I tested with GCC 4.4.

    Read the article

  • Why would the assignment operator ever do something different than its matching constructor?

    - by Neil G
    I was reading some boost code, and came across this: inline sparse_vector &assign_temporary(sparse_vector &v) { swap(v); return *this; } template<class AE> inline sparse_vector &operator=(const sparse_vector<AE> &ae) { self_type temporary(ae); return assign_temporary(temporary); } It seems to be mapping all of the constructors to assignment operators. Great. But why did C++ ever opt to make them do different things? All I can think of is scoped_ptr?

    Read the article

  • send variable fancybox onclick event

    - by samuel saul
    hi, i want to send href value. but its not working. function display () { $.fancybox({ 'href': 'index.php', 'width' : '75%', 'height' : '75%', 'autoScale' : false, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe' }); } i tryed this : function display (who) { $.fancybox({ 'href': 'index.php'+who, 'width' : '75%', 'height' : '75%', 'autoScale' : false, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe' }); } <a onclick="javascript:display("?id=11");" href="#" >create</a> this onclick event inside the innerhtml so its not working with '' why

    Read the article

  • Variable Operators in PHP

    - by BenTheDesigner
    Given this example, how would I return the result of the equation rather than the equation itself as a string? $operator = '+'; foreach($resultSet as $item){ $result = $item[$this->orderField] . $operator . 1; echo $result; }

    Read the article

  • Sinatra Variable Scope

    - by Ethan Turkeltaub
    Take the following code: ### Dependencies require 'rubygems' require 'sinatra' require 'datamapper' ### Configuration config = YAML::load(File.read('config.yml')) name = config['config']['name'] description = config['config']['description'] username = config['config']['username'] password = config['config']['password'] theme = config['config']['theme'] set :public, 'views/themes/#{theme}/static' ### Models DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/marvin.db") class Post include DataMapper::Resource property :id, Serial property :name, String property :body, Text property :created_at, DateTime property :slug, String end class Page include DataMapper::Resource property :id, Serial property :name, String property :body, Text property :slug, String end DataMapper.auto_migrate! ### Controllers get '/' do @posts = Post.get(:order => [ :id_desc ]) haml :"themes/#{theme}/index" end get '/:year/:month/:day/:slug' do year = params[:year] month = params[:month] day = params[:day] slug = params[:slug] haml :"themes/#{theme}/post.haml" end get '/:slug' do haml :"themes/#{theme}/page.haml" end get '/admin' do haml :"admin/index.haml" end I want to make name, and all those variables available to the entire script, as well as the views. I tried making them global variables, but no dice.

    Read the article

  • Find actual value of PHP variable

    - by Simon S
    Hi all. I am having a real headache with reading in a tab delimited text file and inserting it into a MySQL Database. The tab delimited text file was generated (I think) from a MS SQL Database, and I have written a simple script to read in the file and insert it into an existing table in my MySQL database. However, there seems to be some problem with the data in the txt file. When my PHP script parses the file and I output the INSERT statements, the values in each of the fields are longer than they should be. For example, the first field should be a simple two character alphanumeric value. If I echo out the INSERT statements, using Firebug (in Firefox), between each of the characters is a question mark in a black diamond. If I var_dump the values, I get the following: string(5) "A1" Now, this clearly shows a two character string, but var_dump tells me it is five characters long!! If I trim() the value, all I get is the first character (in this case "A"). How can I get at the other characters, even if it is only to remove them? Additionally, this appears to be forcing MySQL to insert the value as a BLOB, not as a varchar as it should. Simon

    Read the article

  • How to trim whitespace from bash variable?

    - by too much php
    I have a shell script with this code: var=`hg st -R "$path"` if [ -n "$var" ]; then echo $var fi But the conditional code always executes because hg st always prints at least one newline character. Is there a simple way to strip whitespace from $var (like trim() in php)? or Is there a standard way of dealing with this issue? I could use sed or awk, but I'd like to think there is a more elegant solution to this problem.

    Read the article

  • How to declare a variable in MS SQL and use it in the same Stored Procedure

    - by Nicklas
    Im trying to get the Value from BrandID in one tabel and add it to another tabel. But I can't get it to work. Anybody know how to do it right? CREATE PROCEDURE AddBrand AS DECLARE @BrandName nvarchar(50), @CategoryID int, @BrandID int SELECT @BrandID = BrandID FROM tblBrand WHERE BrandName = @BrandName) INSERT INTO tblBrandinCategory (CategoryID, BrandID) VALUES (@CategoryID, @BrandID) RETURN

    Read the article

  • Dollar ($) sign in password string treated as variable

    - by ncatnow
    Spent some time troubleshooting a problem whereby a PHP/MySQL web application was having problems connecting to the database. The database could be accessed from the shell and phpMyAdmin with the exact same credentials and it didn't make sense. Turns out the password had a $ sign in it: $_DB["password"] = "mypas$word"; The password being sent was "mypas" which is obviously wrong. What's the best way to handle this problem? I escaped the $ with a \ $_DB["password"] = "mypas\$word"; and it worked. I generally use $string = 'test' for strings which is probably how I avoided running into this before. Is this correct behavious? What if this password was stored in a database and PHP pulled it out - would this same problem occur? What am I missing here...

    Read the article

  • How to declare a variable in SQL Server and use it in the same Stored Procedure

    - by Nicklas
    Im trying to get the value from BrandID in one table and add it to another table. But I can't get it to work. Anybody know how to do it right? CREATE PROCEDURE AddBrand AS DECLARE @BrandName nvarchar(50), @CategoryID int, @BrandID int SELECT @BrandID = BrandID FROM tblBrand WHERE BrandName = @BrandName INSERT INTO tblBrandinCategory (CategoryID, BrandID) VALUES (@CategoryID, @BrandID) RETURN

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >