parameters

How to pass a variable number of parameters to a SQL Server stored procedure?

不羁的心 提交于 2019-12-20 19:42:00
问题 I used SQL Server 2005 for my small web application. I Want pass parameters to SP . But there is one condition. number of parameter that can be change time to time. Think ,this time i pass name and Address , next time i pass name,surname,address , this parameter range may be 1-30 , 回答1: You declare the procedure with default parameters and you invoke it with named parameters instead of positional parameters: CREATE PROCEDURE usp_myProcedure @name varchar(100) = '', @surname varchar(100) = '',

Can I specify a default Color parameter in C# 4.0?

偶尔善良 提交于 2019-12-20 17:32:38
问题 Here is an example function: public void DrawSquare(int x, int y, Color boxColor = Color.Black) { //Code to draw the square goes here } The compiler keeps giving me the error: Default parameter value for 'boxColor'must be a compile-time constant I have tried Color.Black, Color.FromKnownColor(KnownColor.Black), and Color.FromArgb(0, 0, 0) How do I make Color.Black be the default color? Also, I do not want to use a string Black to specify it (which I know would work). I want the Color.Black

Can I specify a default Color parameter in C# 4.0?

你说的曾经没有我的故事 提交于 2019-12-20 17:31:28
问题 Here is an example function: public void DrawSquare(int x, int y, Color boxColor = Color.Black) { //Code to draw the square goes here } The compiler keeps giving me the error: Default parameter value for 'boxColor'must be a compile-time constant I have tried Color.Black, Color.FromKnownColor(KnownColor.Black), and Color.FromArgb(0, 0, 0) How do I make Color.Black be the default color? Also, I do not want to use a string Black to specify it (which I know would work). I want the Color.Black

How to read the query string params of a ASP.NET raw URL?

混江龙づ霸主 提交于 2019-12-20 11:37:07
问题 I have a variable string rawURL = HttpContext.Current.Request.RawUrl; How do I read the query string parameters for this url? 回答1: This is probably what you're after Uri theRealURL = new Uri(HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.RawUrl); string yourValue= HttpUtility.ParseQueryString(theRealURL.Query).Get("yourParm"); 回答2: No need to go through the RawUrl - the Request object already contains a parsed version,

How to read the query string params of a ASP.NET raw URL?

走远了吗. 提交于 2019-12-20 11:37:07
问题 I have a variable string rawURL = HttpContext.Current.Request.RawUrl; How do I read the query string parameters for this url? 回答1: This is probably what you're after Uri theRealURL = new Uri(HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.RawUrl); string yourValue= HttpUtility.ParseQueryString(theRealURL.Query).Get("yourParm"); 回答2: No need to go through the RawUrl - the Request object already contains a parsed version,

SQL: How do I use parameter for TOP like in SELECT TOP @amount? [duplicate]

柔情痞子 提交于 2019-12-20 10:59:32
问题 This question already has answers here : Use variable with TOP in select statement in SQL Server without making it dynamic [duplicate] (3 answers) Closed 5 years ago . Using the vs2008 query builder, I’m trying to make a query that gets a parameter for the " TOP " Command, and then I face an error "Error in top expression" Works: SELECT TOP 5 * FROM dbo.SomeTable WHERE SomeColumn = SomeValue Doesn't Work: SELECT TOP @param1 * FROM dbo.SomeTable WHERE SomeColumn = SomeValue alt text http://www

How to retrieve value of a ui:param in the backing bean

本秂侑毒 提交于 2019-12-20 10:54:41
问题 I'm passing a parameter p1 to another page page.xhtml : <ui:include src="page.xhtml"> <ui:param name="p1" value="#{someObject}"/> </ui:include> Is this possible to evaluate #{p1} inside @PostConstruct method of the backing bean of page.xhtml ? Using the following piece of code, #{p1} cannot resolve: FacesContext currentInstance = FacesContext.getCurrentInstance(); currentInstance.getApplication().evaluateExpressionGet(currentInstance, "#{p1}", String.class); Why do I need this? I'm using an

Member function template with the number of parameters depending on an integral template parameter

最后都变了- 提交于 2019-12-20 10:37:26
问题 I have the following class template: template<class T, unsigned N> class MyClass; where T is some type, N - number of components. It is possible to initialize the class using MyClass{a1, a2, a3} where the number of arguments is equal to N . I want to add a member function template (let's name it foo ) of MyClass that would meet the following requirements: It is templated by another type T2 (i.e. template<class T2> void foo(..) ) It accepts enough data to construct MyClass<T,N> , but not less

Passing multiple parameters in an MVC Ajax.ActionLink

对着背影说爱祢 提交于 2019-12-20 10:29:22
问题 I am using an Ajax.ActionLink to call an Action in a Controller, nothing special there. I want to pass two parameters to the Action. Is this possible using an Ajax.ActionLink? I thought that it would just be a matter of including multiple values in the AjaxOptions: <%= Ajax.ActionLink("Link Text", "ActionName", "ControllerName", new { firstParameter = firstValueToPass, secondParameter = secondValueToPass }, new AjaxOptions{ UpdateTargetId = "updateTargetId"} )%> Is it possible to pass

How Do I Call An Inherited JavaScript Constructor With Parameters?

北慕城南 提交于 2019-12-20 10:25:44
问题 Greetings, After reading the following article I have a question: https://developer.mozilla.org/en/Introduction_to_Object-Oriented_JavaScript In the inheritance example, the Person constructor doesn't take any parameters. How would this same example look if I were to add one and call it from the Student constructor? Thanks! 回答1: Well, a way that you can re-use the logic of the Person constructor is invoking it with call or apply, for example: function Person(gender) { this.gender = gender; }