parameters

Is it possible, with the Python Standard Library (say version 2.5) to perform MS-SQL queries which are parameterized?

While the particular data I'm working with right now will not be user-generated, and will be sanitized within an inch of its life during my usual validation routines, I would like to learn how to do your basic INSERT, SELECT, etc. SQL queries while protecting myself against SQL injection attacks, just for future reference. I'd rather le...

Byte array as an out parameter not recognized

I had a webmethod working which returned a byte array to the caller: public byte[] DownloadPDF(string URI) I had to change this to return another output (a string). So, I decided to change the method completely by now returning void and having 3 parameters like this: public void DownloadFile(string URI, out byte[] docContents, out st...

hitting the 2100 parameter limit (sql-server) when using Contains()

from f in CUSTOMERS where depts.Contains(f.DEPT_ID) select f.NAME depts is a list (IEnumerable<int>) of department ids this query works fine until you pass a large list (say around 3000 dept ids) .. then i get this error: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameter...

Problem injecting a VB parameter into a stored procedure (FireBird)

Everyone here has always been such great help, either directly or indirectly. And it is with grand hope that this, yet again, rings true. For clarification sakes, the Stored Procedure is running under FireBird and the VB is of the .NET variety I have a stored procedure (excerpt below, important bit is the WHERE) select pn, pnm.desc...

Passing several parameters as a single parameter in Java.

I've seen an example of it before, but I've never really found any good reference material dealing with it. I know it's possible to pass in several parameters, ints for example, by defining the method as public void aMethod(int...a) But I don't know any more about it than that. I've seen an example, and it returned the average of ...

Get url parameters from a string in .NET

Okay, this is probably a simple one... I've got a string in .NET which is actually a url. I want an easy way to get the value from a particular parameter. Normally, I'd just use Request.Params["theThingIWant"], but this string isn't from the request. I can create a new Uri item like so: Uri myUri = new Uri(TheStringUrlIWantMyValue...

Rails Remote Form does not post form parameters.

Hello, my question involves the following partial view with a remote form: <% remote_form_for :phone_number, :url => {:controller => "edit", :action => "add_phone_number" }, :update => "phone_number_div" do |form| %> <%= form.text_field :number%> <%= form.select :type, PhoneNumber::PHONE_TYPE%> <%= submit_tag "Add" %> <% end %> ...

C# constructing paramater query SQL - LIKE %

I am trying to build SQL for a parameter query in C# for a query which will contain the LIKE %% command. Here is what I am trying to acheive (please note that the database is Firebird) var SQL = string.format("SELECT * FROM {0} WHERE {1} LIKE '%?%'", TABLE, NAME); Cmd.Parameters.AddWithValue(NAME, "JOHN"); Now I have tried every sing...

Are .NET ref parameters thread-safe, or vulnerable to unsafe multithreaded access?

Edit for intro: We know that a ref parameter in C# passes a reference to a variable, allowing the external variable itself to be changed within a called method. But is the reference handled much like a C pointer (reading the current contents of the original variable with every access to that parameter and changing the original variable ...

Passing parameters to constructor for an AS3 auto-created asset class

I'm creating a MovieClip subclass (let's call it MyClip) that I want to use for several library assets. I'll be instantiating these movie clips from ActionScript code. MyClip has a constructor parameter that allows it to set the initial values of certain properties. Since I want to use it for multiple library assets, the logical way to ...

SSRS: Asp.NET ReportViewer parameters reset to default when clicking View Report

Hi, I have a SQL Reporting Services Report (SQL 2008 built using Report Builder v2.0) which has a multi select integer parameter (in this case a list of stores). The default value is 0 ('All Stores'). The Parameter is passed to a Stored Procedure as varchar(1024). This all works fine in Report Builder or from the Reporting Services Web...

add param value to all the object

hello i want to add param value to all the object in a page. like param name="wmode" value="transparent" to all the object. how can i do that ...

how explicit should I be with my overloads?

I'm building a wrapper for a jquery plugin to C# and I dont like the usage of [Optional] because its not as "optional" as it says it is(meaning you still have to declare that System.Missing library) so I decided to use overloaded methods. I want to give the user alot of customization but I'm not sure how explicit I should be with my over...

ATL: I want to create a coclass that I can use as a parameter for a method in my class. Why can't I get this to work?

Hello Everyone, I've created a COM object using ATL. I want to create a new object that can be returned from a method, and passed in as a parameter. I've created the coclass, but I can't figure out how to add a method that will accept it as a parameter. The error I'm getting is MIDL2025: syntax error: expecting a type specification nea...

Application Variable in SQLDataSource control parameter

Perhaps this is laziness on my part, but in the same way I can reference a connection string from my web.config using <%$ ConnectionStrings:con %>, I'd like to do similar referencing an Application variable in one of my select parameters. Something like: <asp:Parameter Name="AppVal" Type="Int32" DefaultValue="<% Application['MyVal'] %>...

Optional function parameters: Use default arguments (NULL) or overload the function?

I have a function that processes a given vector, but may also create such a vector itself if it is not given. I see two design choices for such a case, where a function parameter is optional: Make it a pointer and make it NULL by default: void foo(int i, std::vector<int>* optional = NULL) { if(optional == NULL){ optional = new...

Is there a reasonable approach to "default" type parameters in C# Generics?

In C++ templates, one can specify that a certain type parameter is a default. I.e. unless explicitly specified, it will use type T. Can this be done or approximated in C#? I'm looking for something like: public class MyTemplate<T1, T2=string> {} So that an instance of the type that doesn't explicitly specify T2: MyTemplate<int> t ...

How can you use parameterized statements with DB2 Text Search?

I've tried this: select * from ourschema.mytable where contains(mysearchablefield, @searchTerms) = 1; Where @searchTerms was set to "search terms" Unfortunately, it only produced an error: ERROR [42610] [IBM][DB2/NT] SQL0418N A statement contains a use of a parameter marker that is not valid. SQLSTATE=42610 Is there a way to us...

How exactly keyword 'params' work?

The following code sample prints: T T[] T[] While first two lines are as expected, why compiler selected param array for a regular array? public class A { public void Print<T>(T t) { Console.WriteLine("T"); } public void Print<T>(params T[] t) { Console.WriteLine("T[]"); } } class Program { ...

find the hwnd of a window which user selects, through c#

I've written a c# program which reproduces keyboard strokes programatically. My idea was to pass these keyboard strokes to another application which may have a textbox set in focus. So in my program i want the user to select the window to which i must redirect the keyboard strokes to. For that, I want to know a method where i can wait,...