Search Results

Search found 7375 results on 295 pages for 'parameter'.

Page 30/295 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • Binding a date string parameter in an MS Access PDO query

    - by harryg
    I've made a PDO database class which I use to run queries on an MS Access database. When querying using a date condition, as is common in SQL, dates are passed as a string. Access usually expects the date to be surrounded in hashes however. E.g. SELECT transactions.amount FROM transactions WHERE transactions.date = #2013-05-25#; If I where to run this query using PDO I might do the following. //instatiate pdo connection etc... resulting in a $db object $stmt = $db->prepare('SELECT transactions.amount FROM transactions WHERE transactions.date = #:mydate#;'); //prepare the query $stmt->bindValue('mydate', '2013-05-25', PDO::PARAM_STR); //bind the date as a string $stmt->execute(); //run it $result = $stmt->fetch(); //get the results As far as my understanding goes the statement that results from the above would look like this as binding a string results in it being surrounded by quotes: SELECT transactions.amount FROM transactions WHERE transactions.date = #'2013-05-25'#; This causes an error and prevents the statement from running. What's the best way to bind a date string in PDO without causing this error? I'm currently resorting to sprintf-ing the string which I'm sure is bad practise. Edit: if I pass the hash-surrounded date then I still get the error as below: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[22018]: Invalid character value for cast specification: -3030 [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. (SQLExecute[-3030] at ext\pdo_odbc\odbc_stmt.c:254)' in C:\xampp\htdocs\ips\php\classes.php:49 Stack trace: #0 C:\xampp\htdocs\ips\php\classes.php(49): PDOStatement-execute() #1 C:\xampp\htdocs\ips\php\classes.php(52): database-execute() #2 C:\xampp\htdocs\ips\try2.php(12): database-resultset() #3 {main} thrown in C:\xampp\htdocs\ips\php\classes.php on line 49

    Read the article

  • VB.NET function that takes other functions as a parameter, and executes them

    - by rob
    Hello, Is there a way in vb.net to create a sub/function that will take as an argument some kind of pointer to another function, and allow this new sub/function to execute the passed function? What I have are 10-12 xml-rpc functions I am calling against a remote server. Each of these functions has different argument lists (one takes 1 string, another might take 3 strings and one int, etc). All of them return an object. As I am calling these, it seems like it should be able to be factored better. For instance, everytime I call any of these functions, I want to test the return value for a session drop, and do something to try and reconnect to the remote system, etc. Using .net 3.5 Thanks! -R

    Read the article

  • Limiting selected rows count with a stored procedure parameter in MySQL

    - by ssobczak
    I have a procedure SelectProc wich contains SELECT statement. I want to add a procedure param LimitRowsCount and use it as following: CREATE PROCEDURE SelectProc (IN LimitRowsCount INTEGER UNSIGNED) BEGIN SELECT (...) LIMIT LimitRowsCount; END but this approach doesn't work. The SELECT itself contains nested subqueries so I can't create view from it. Is there a way more propper then dynamic SQL (prepared statements) ?

    Read the article

  • Scala type system : basic type mismatch

    - by SiM
    I have a basic type system type mismatch problem: I have a class with a method def Create(nodeItem : NodeItem) = {p_nodeStart.addEndNode(nodeItem)} where p_nodeStart is NodeCache class NodeCache[END_T<:BaseNode] private(node: Node) extends BaseNode { def addEndNode(endNode : END_T) = {this.CACHE_HAS_ENDNODES.Create(endNode)} and the error its giving me is: error: type mismatch; found : nodes.NodeItem required: Nothing def Create(nodeItem : NodeItem) = {p_nodeStart.addEndNode(nodeItem)} while the NodeCache is defined as object NodeTrigger { def Create() { val nodeTimeCache = NodeCache.Create[NodeItem](node) and in object NodeCache object NodeCache { def Create[END_T<:BaseNode]() { val nodeCache = new NodeCache[END_T](node); Any ideas, how to fix the error?

    Read the article

  • Databinding a property with a parameter

    - by clawson
    I would like to databind to a property that requires arguments. What is the best way do to this? are there work arounds? I'm open to any suggestions. I thought about defining custom columns and cells because the parameters that the property requires are available from the within the object bound to the row, but I'm having trouble materialising this idea. Thanks in advance for the help.

    Read the article

  • How to pass Endpoint parameter to Endpoint defined as bean in Spring conext

    - by sempa
    I have camel Fileendpoint defined in following way: <bean id="hotfolderEndpoint" class="org.apache.camel.component.file.FileEndpoint" factory-bean="camel" factory-method="getEndpoint"> <constructor-arg ref="hotfolder" /> </bean> I want to define some File parameters such as preMove, move etc. Variable hotfolder is String taken from JNDI and I have no impact on it. When I define property as <bean id="moveExp" class="org.apache.camel.model.language.SimpleExpression"> <property name="expression" value="done/${file:name}"/> </bean> it is not correctly parsed and the file get name done/name

    Read the article

  • explicit copy constructor or implicit parameter by value

    - by R Samuel Klatchko
    I recently read (and unfortunately forgot where), that the best way to write operator= is like this: foo &operator=(foo other) { swap(*this, other); return *this; } instead of this: foo &operator=(const foo &other) { foo copy(other); swap(*this, copy); return *this; } The idea is that if operator= is called with an rvalue, the first version can optimize away construction of a copy. So when called with a rvalue, the first version is faster and when called with an lvalue the two are equivalent. I'm curious as to what other people think about this? Would people avoid the first version because of lack of explicitness? Am I correct that the first version can be better and can never be worse?

    Read the article

  • Wrapping allocated output parameters with a scoped_ptr/array

    - by Danra
    So, I have some code which looks like this: byte* ar; foo(ar) // Allocates a new[] byte array for ar ... delete[] ar; To make this safer, I used a scoped_array: byte* arRaw; scoped_array ar; foo(arRaw); ar.reset(arRaw); ... // No delete[] The question is, Is there any existing way to do this using just the scoped_array, without using a temporary raw array? I can probably write an in-place "resetter" class, just wondering if the functionality exists and I'm missing it. Thanks, Dan

    Read the article

  • pthread with unique struct as parameter C

    - by sergiobuj
    Hi, i have this piece of code that is giving me trouble. I know all the threads are reading the same struct. But i have no idea how to fix this. #include <pthread.h> #include <stdio.h> #include <stdlib.h> typedef struct { int a,b; } s_param; void * threadfunc(void *parm) { s_param *param2 = parm; printf("ID:%d and v:%d\n",param2->a,param2->b); pthread_exit(NULL); } int main(int argc, char **argv) { pthread_t thread[3]; int rc=0,i; void * status; for(i=0; i<3 ; ++i){ s_param param; param.b=10; param.a=i; rc = pthread_create(&thread[i], NULL, threadfunc, &param ); // !!!! if(rc){ exit(1); } } for(i=0; i<3 ; ++i){ pthread_join(thread[i],&status); } return 0; } output: ID:2 and v:10 ID:2 and v:10 ID:2 and v:10 and what i need: ID:0 and v:10 ID:1 and v:10 ID:2 and v:10 Thank you.

    Read the article

  • URL rewrite with ?lang= parameter

    - by agorom7
    my developer is saying that it is not possible to rewrite url form example.com/name/name/?lang=english to example.com/en/name/name/ is it possible to do or not? if yes, how should it be done? if not, what could be the reasons? we have windows based hosting from maddogdomains (godaddy)

    Read the article

  • Scala 2.8: use Java annotation with an array parameter

    - by yournamehere
    I'm trying to implement an JavaEE Session Bean with Scala 2.8. Because it's a Remote Session Bean, i have to annotate it with the following Java Annotation: @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Remote { Class[] value() default {}; } I only found this example for scala 2.7. In Scala 2.7, its possible to define the session bean like this: @Remote {val value = Array(classOf[ITest])} class MyEJB ... How can i use this annotation the same way with Scala 2.8? I already tried many different versions, all resulting in "annotation argument needs to be a constant", "illegal start of simple expression". All of these definitions don't work: @Remote{val value = Array(classOf[PersonScalaEJB])} @Remote(val value = Array(classOf[PersonScalaEJB])) @Remote(Array(classOf[PersonScalaEJB]))

    Read the article

  • Use Hudson Build Parameter in Grails Build Target

    - by Stephen Swensen
    I have created two Hudson String Parameters in my parametrized build configuration: svnRoot, and svnBranch. I can reference these just fine when specifying my Repository URL: ${svnRoot}/${svnBranch}/subProject. But I have not been able to reference them as part of my Grails Build Target: "build-applet ${svnRoot}/${svnBranch}/appletProject username password" "war --non-interactive". build-applet invokes a Gant script in the Grails project at scripts\BuildApplet.groovy. This attempt yields the following error: groovy.lang.MissingPropertyException: No such property: svnRoot for class: Script1 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:240) at Script1.run(Script1.groovy:1) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:561) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:536) at com.g2one.hudson.grails.GrailsBuilder.evalTarget(GrailsBuilder.java:212) at com.g2one.hudson.grails.GrailsBuilder.perform(GrailsBuilder.java:168) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:603) at hudson.model.Build$RunnerImpl.build(Build.java:172) at hudson.model.Build$RunnerImpl.doRun(Build.java:137) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:417) at hudson.model.Run.run(Run.java:1337) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:140) What is the best and or easiest way to achieve my goal?

    Read the article

  • $.(ajax) wrapper for Jquery - passing parameters to delegates

    - by gnomixa
    I use $.(ajax) function extensively in my app to call ASP.net web services. I would like to write a wrapper in order to centralize all the ajax calls. I found few simple solutions, but none address an issue of passing parameters to delegates, for example, if i have: $.ajax({ type: "POST", url: "http://localhost/TemplateWebService/TemplateWebService/Service.asmx/GetFoobar", data: jsonText, contentType: "application/json; charset=utf-8", dataType: "json", success: function(response) { var results = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d; OnSuccess(results, someOtherParam1, someOtherParam2); }, error: function(xhr, status, error) { OnError(); } }); The wrapper to this call would have to have the way to pass someOtherParam1, someOtherParam2 to the OnSuccess delegate...Aside from packing the variables into a generic array, I can't think of other solutions. How did you guys address this issue?

    Read the article

  • linq null parameter

    - by kusanagi
    how can i do the code static string BuildMenu(List<Menu> menu, int? parentId) { foreach (var item in menu.Where(i => i.ParentMenu == parentId || i.ParentMenu.MenuId == parentId).ToList()) { } } return BuildMenu(menuList,null); so if parentId==null then return only records i = i.ParentMenu == null but when parentId is 0 then return records with i.ParentMenu.MenuId == parentId

    Read the article

  • Can someone explain me the parameter RETURN_VALUE ?

    - by Ronnie Chester Lynwood
    hello. I want to know what does RETURN_VALUE means! I'm stucked at this thing. how to use RETURN_VALUE on MSSQL SP ? thanks.. ASP: Set cmdDB = Server.CreateObject("ADODB.Command") With cmdDB .ActiveConnection = ADOConM .CommandText = "usp_jaljava_member_select" .CommandType = adCmdStoredProc .Parameters.Append .CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, 0) .Parameters.Append .CreateParameter("@TLoginName", adVarChar, adParamInput, 15,lcase(TLoginName)) .Parameters.Append .CreateParameter("@TPassword", adVarChar, adParamInput, 20,TPassword) .Parameters.Append .CreateParameter("@retval", adVarChar, adParamOutput, 50) ' .Parameters.Append .CreateParameter("@TPinCode", adVarChar, adParamInput, 15,TPinCode) .Execute,,adExecuteNoRecords RetVal = .Parameters("@retval") Ret = Trim(.Parameters("RETURN_VALUE")) 'Set .ActiveConnection = Nothing End With Set cmdDB = Nothing UTid = RetVal MSSQL SP: CREATE PROCEDURE usp_jaljava_member_select @TLoginName varchar(15), @TPassword varchar(20), @retval varchar(50) OUTPUT --@TPinCode varchar(15) AS

    Read the article

  • Return an Oracle Associative Array from a function

    - by Paul Johnson
    Does anybody know if it is possible to return an associative array as the result of an Oracle function, if so do you have any examples? I have an Oracle package which contains an associative array declaration as defined below: TYPE EVENTPARAM IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; This is then used in a stored procedure outside the package as follows: v_CompParams areva_interface.eventparam; The intention is to store an associative array of strings in the variable v_CompParams, returned from a Parse function in another package. The definition for which is as follows: PACKAGE STRING_MANIP IS TYPE a_array IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; FUNCTION Parse (v_string VARCHAR2, v_delim VARCHAR2) RETURN a_array; FUNCTION RowCount(colln IN a_array) RETURN NUMBER; END; The code which implements this is: v_CompParams := STRING_MANIP.PARSE(v_CompID,v_Delim); Unfortunately it doesn't work, I get the error 'PLS-00382: expression is of wrong type'. I foolishly assumed, that since a_array derives from the same source Oracle type as the variable v_CompParams, that there would be no problem casting between them. Any help much appreciated. Kind Regards Paul J.

    Read the article

  • What to pass to UserType, BlobType.setPreparedStatement session parameter

    - by dlots
    http://blog.xebia.com/2009/11/09/understanding-and-writing-hibernate-user-types/ I am attempting to defined a customer serialization UserType that mimics, the XStreamUserType referenced and provided here: http://code.google.com/p/aphillips/source/browse/commons-hibernate-usertype/trunk/src/main/java/com/qrmedia/commons/persistence/hibernate/usertype/XStreamableUserType.java My serializer outputs a bytearray that should presumably written to a Blob. I was going to do: public class CustomSerUserType extends DirtyCheckableUserType { protected SerA ser=F.g(SerA.class); public Class<Object> returnedClass() { return Object.class; } public int[] sqlTypes() { return new int[] {Types.BLOB}; } public Object nullSafeGet(ResultSet resultSet,String[] names,Object owner) throws HibernateException,SQLException { if() } public void nullSafeSet(PreparedStatement preparedStatement,Object value,int index) throws HibernateException,SQLException { BlobType.nullSafeSet(preparedStatement,ser.ser(value),index); } } Unfortunetly, the BlobType.nullSafeSet method requires the session. So how does one define a UserType that gets access to a servlet requests session? EDIT: There is a discussion of the issue here and it doesn't appear there is a solution: Best way to implement a Hibernate UserType after deprecations?

    Read the article

  • Paypal IPN call back with parameter

    - by proyb2
    I want to automate a process after user have made a payment. 1) User enter details on forms and submit, the session will pass unique ID to paypal 2) After user complete the paypal payment, unique ID is then pass back to my server for the script to read and register into db. How do I do that?

    Read the article

  • Passing an object as parameter from Andriod to web service using ksoap

    - by user3718626
    I have an object called User which implements KvmSerializable. Would like to pass this object to the webservice. PropertyInfo pi = new PropertyInfo(); pi.setName("obj"); pi.setValue(user); pi.setType(user.getClass()); request.addProperty(pi); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(request); envelope.addMapping(NAMESPACE, "User",User.class); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); I get the following error.... SoapFault - faultcode: 'soapenv:Server' faultstring: 'Unknow type {http://users.com}User' faultactor: 'null' detail: org.kxml2.kdom.Node@53263024 at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:141) at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:140) at org.ksoap2.transport.Transport.parseResponse(Transport.java:118) at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:272) at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118) at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113) at com.compete.WebServiceCallTask.getQuestion(WebServiceCallTask.java:114) at com.compete.WebServiceCallTask.doInBackground(WebServiceCallTask.java:53) at com.compete.WebServiceCallTask.doInBackground(WebServiceCallTask.java:1) at android.os.AsyncTask$2.call(AsyncTask.java:287) at java.util.concurrent.FutureTask.run(FutureTask.java:234) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:856) Appreciate if any one can point me to an sample code or can direct me what is the issue. Thanks.

    Read the article

  • MOSS ItemStyle.xsl parameter

    - by nav
    Hi, I am trying feed the site URL as a path into HTML rendered by the ItemStyle.xsl. Could anyone please give me some pointers? I need to know how I can extract the site URL from ItemStyle.xsl. Many Thanks, Nav

    Read the article

  • Passing Interface Class as a Parameter in Java

    - by aleclerc
    I have an interface: public interface IMech { } and a class that implements it public class Email implements IMech { } and a third class that has this method implemented: public void sendNotification( Class< IMech > mechanism ){ } now I'm trying to call that method like so foo.sendNotification(Email.class); but i keep getting an exception saying: The method sendNotification(Class<IMechanism>) in the type RemediationOperator is not applicable for the arguments (Class<EmailNotification>) Shouldn't this work if it interfaces that class?

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >