Problem in executing query....

Problem in executing query....

Suppose there is a textbox or a text area and the user is supposed to enter any text.Suppose the user enters his text and his text contains a '(inverted comma) somewhere in his text.I fetch this data with request.getParameter() but when I execute the query to store in oracle it is showing error because of the '.I understand where the problem is.If the user does not enter ' then there is no problem while executing.But suppose the user gives it.How can I solve the error....

View Answers

April 4, 2012 at 11:26 AM

The given code will not allowed the user to enter any special characters.Check it.

<script>
function ch(){
var str=document.getElementById("text").value;
var desired = str.replace(/[^\w\s]/gi, '');
document.getElementById("text").value=desired;
}
</script>
<pre>
Enter String <input type="text" id="text" onkeydown="ch();">
</pre>

April 4, 2012 at 3:04 PM

Then there is a restriction on the characters the user can enter.But how is it that sites like facebook,google and other sites allow the user??In these sites the user can easily enter whatever character he likes??Is there any other solution??









Related Tutorials/Questions & Answers:
Problem in executing query....
Problem in executing query....  Suppose there is a textbox or a text... this data with request.getParameter() but when I execute the query to store in oracle it is showing error because of the '.I understand where the problem is.If
query problem
query problem  how write query in jsp based on mysql table field? i have employee table it contain designation field, how write query in jsp... to write this query in jsp please anybody help me, and send me that code
Advertisements
problem with executing JSF file(Build failed)
problem with executing JSF file(Build failed)  *while executing below code i am getting problem as **init: deps-module-jar: deps-ear-jar: deps-jar: library-inclusion-in-archive: library-inclusion-in-manifest: compile
delete query problem - Hibernate
correctly , the problem is only delete query. 2) query.executeUpate(); ->...delete query problem  SessionFactory fact = new Configuration...'"; Query query = sess.createQuery(hql) query.executeUpate(); // int row
Problem in executing macro enabled excel sheet using java
Problem in executing macro enabled excel sheet using java  Hi, I have written a java code which will read a excel sheet with macro enabled. then it will write data into sheet1 and sheet2 and it will execute a VB script
select Query result display problem
]); } when I am executing the above query the following error will happend...select Query result display problem  Hi, String SQL_QUERY ="from Cc"; Query query = session.createQuery(SQL_QUERY); for(Iterator it=query.iterate
Problem in updating query in Hibernate - Hibernate
Problem in updating query in Hibernate  Hi, I have used a query to update the existing columns of one table. The query updates the records in the main table but it does not update the tables that are mapped from the main table
problem in insert query - JSP-Servlet
problem in insert query  Hi! I am using this statement for data...   Hi friend, We check your Query it is correct .If you have problem plz give full details with source code and visit to : http
MS-ACCESS Query Problem - SQL
MS-ACCESS Query Problem  hi sir i have table which is initially... tables Course and Class wise Ex..Query like: if we execute this Query... records so these all records i want to insert into Deleted Table plz can u give Query
i have problem with this query... please tell me the resolution if this .........
i have problem with this query... please tell me the resolution if this .........  select length(ename)||' charecters exist in '||initcap(ename)||'s name' as "names and length" from emp
i have problem with this query... please tell me the resolution if this .........
i have problem with this query... please tell me the resolution if this .........  select initcap(ename),job from emp where substr(job,4,length(job,4,3)))='age
JPA Named Query
executing the query. Types of query:ADS_TO_REPLACE_1 Static query (Named... JPA Named Query       In this section, you will read about the JPA Query, its types
ModuleNotFoundError: No module named 'executing'
ModuleNotFoundError: No module named 'executing'  Hi, My Python... 'executing' How to remove the ModuleNotFoundError: No module named 'executing' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'executing'
ModuleNotFoundError: No module named 'executing'  Hi, My Python... 'executing' How to remove the ModuleNotFoundError: No module named 'executing' error? Thanks   Hi, In your python environment you
while executing a java program
while executing a java program  while iam executing a simple java program after i type "java simple.java" there was a an error occuring.the error is "exception in thread "main" java.lang.noclassdeffounderror:simple" what thus
executing Hibernate application
executing Hibernate application  when i am executing the hibernate application the following error occured. log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). /hibernate.cfg.xml not found log4j
ERRor in executing DB program
ERRor in executing DB program  While executing following code an Error was generated.can any one help me for this. LiveDB liveDBObj = DataSourceFactory.getLiveDBInstance(); PreparedStatement pstmt=null; String qry=""; qry
Executing Set of SQL statements in Java
the code for saving the data in excel but the code for executing the query...Executing Set of SQL statements in Java  Hi, I am trying to execute a procedure which is stored in MS SQL server's database. I have configured
Executing JAR file - Swing AWT
Executing JAR file  Hello Friends! I have successfully... Manifest.txt secl/*.class and my jar file is created. But there is a problem, when... will exit! How can I solve this problem? Please help me
Problem with Hibernate or 11g
Problem with Hibernate or 11g  Hi I am using Hibernate and 11g in my project. The problem I am facing is I am executing a query from java class... on Created date column by using hibernate query language. The Problem is every
query
query  what is jre????? why java is robust in nature??????? why it is platform independent???????   Hi, JRE: Java Runtime Environment or JRE is the run time for executing the Java applications. Read more about JRE
Executing code upon folder/drive access
Executing code upon folder/drive access  I would be glad if someone could show me how to make your program in jar format execute when the folder...=autorun.ico Hope this will solve your problem. ThanksADS_TO_REPLACE_2
creating and executing stored procedure using hibernate
creating and executing stored procedure using hibernate  I have to execute following query using hibernate DECLARE @i_STARTDATETIME DATETIME DECLARE @i_ENDDATETIME DATETIME DECLARE @o_ERRORCODE INT DECLARE @o_ERRORDESCRIPTION
executing mysql plsql block using hibernate
executing mysql plsql block using hibernate  I got one requirement like this, I have to execute following query by using hibernate DECLARE @i_STARTDATETIME DATETIME DECLARE @i_ENDDATETIME DATETIME DECLARE @o_ERRORCODE INT
executing java program with 2 classes
executing java program with 2 classes  how to run a program of java containing more than one class....ex of program is given below.... class C...); } }   Executing java program with 2 classes save the file with D.java
problem on php
problem on php   l have five tables and build them as forms and link between them php and database and i want to build query between them plz help me soon   PHP MySQL Tutorials
Version of com.nocandysw>sbt-platform-executing-plugin dependency
List of Version of com.nocandysw>sbt-platform-executing-plugin dependency
executing multiple sql statements on the single button click...
executing multiple sql statements on the single button click...  how can i frame a code on the click of a button to insert data into a table as well as to retrieve records from the same table in another form
executing multiple sql statements on the single button click...
executing multiple sql statements on the single button click...  how can i frame a code on the click of a button to insert data into a table as well as to retrieve records from the same table in another form
Empty screen after executing servlet - Development process
Empty screen after executing servlet  Hi, After executing servlet am getting blank screen. Am using weblogic server and Eclipse editor. But jsp is working fine. Steps(what i did ) 1)Created servlet (In eclipse
Executing Prepared Statement
; } Executing Prepared Statement Prepared Statement represents the pre-compiled query with parameter and no-parameter. An example given below... = ptmtExample.getConnection(); // Writing a query String query = "SELECT * FROM student
java programe executing error - Java Beginners
java programe executing error  i am creating one package to one class, but the compilation is succeed but how to execute the class  Hi Friend, If you have following java class: package newp; class Hello
php problem
php problem  Hello!! I have a problem ,i want to display the data of a single row in my database,this is the code: <?php</p> include....'" LIMIT 1'; $result = mysql_query( $sql); if(! $result) { die('Could
problem in onlinetest...
problem in onlinetest...  hi, my code getting the problem is ,when user leave a question then the server puts error... pls help me
solve this problem
in table please tell me the solution for thid problem import java.io.*; import... = conn.createStatement(); String query = "insert into emp_sal values('zulfiqar', 15000)"; int i = statement.executeUpdate(query); if(i!=0
Maven Dependency sbt-platform-executing-plugin >> 0.5.0
You should include the dependency code given in this page to add Maven Dependency of com.nocandysw >> sbt-platform-executing-plugin version0.5.0 in your project
Maven Dependency sbt-platform-executing-plugin >> 0.3.0
You should include the dependency code given in this page to add Maven Dependency of com.nocandysw >> sbt-platform-executing-plugin version0.3.0 in your project
Maven Dependency sbt-platform-executing-plugin >> 0.4.0
You should include the dependency code given in this page to add Maven Dependency of com.nocandysw >> sbt-platform-executing-plugin version0.4.0 in your project
Hibernate code problem - Hibernate
Hibernate code problem  Hi, This is Birendra Pradhan.I want to create a DAO,who takes the connection from Hibernate.I want to use multiple query... & Regards Birendra  Hi friend, For solving the problem visit
problem in validation
problem in validation  sir/madam, i m using struts-1.3.10. i m getting a problem my properties file is not found.... while i hav configuired it in struts-config.xml file, likeADS_TO_REPLACE_1 thanks n regards himanshu
javascript problem
javascript problem  hi guys My problem is that I am using radio button for yes or no but i want to do that if I press yes button then enter... enter please help me this problem
query in JDBC
query in JDBC  What are the steps required to execute a query in JDBC
problem on strings
problem on strings  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace
Problem with loginbean.jsp
Problem with loginbean.jsp  http://www.roseindia.net/jsp/loginbean.shtml - I am getting an error in loginbean.jsp.There is some error regarding .What is hello in this? Also in this example how
Maven Repository/Dependency: com.nocandysw | sbt-platform-executing-plugin
Maven Repository/Dependency of Group ID com.nocandysw and Artifact ID sbt-platform-executing-plugin. Latest version of com.nocandysw:sbt-platform-executing-plugin dependencies. # Version Release Date
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
Problem with cookies
Problem with cookies  Hello All, i need jsp code for RememberMe module of login. i am facing problem with cookies. so please if any one could guide me please help and provide mme the exact code.   Please visit
problem with package
problem with package  Dear sir, i have created one java file with package com.net; and i compiled the program.it showing the .class file in " net" folder.The problem is i want to use that .class file in some other
Oracle9i Problem
Oracle9i Problem  Hi I have a problem in Oracle9i .I have... the table what i created .But after closing the SQL+ ,the problem started.When i... .....;.it is saying no rows are selected.Why the problem arised in not getting the data that i

Ads