Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC Problem in executing query....
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Mainak
Problem in executing query....
2 Answer(s)      2 years and 8 months ago
Posted in : JDBC


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....


Advertisement
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
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
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
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: Static query (Named query) Dynamic... JPA Named Query       In this section, you will read about the JPA Query, its types
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
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 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
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
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 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
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
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 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... this will solve your problem. Thanks
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
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
Executing Prepared Statement
; } Executing Prepared Statement Prepared Statement represents the pre-compiled query with parameter and no-parameter. An example given below... a query String query = "SELECT * FROM student"; try { // Compiling query
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 in JDBC
query in JDBC  What are the steps required to execute a query in JDBC
Executing anonymous pl/sql block and get resultset in Java
Executing anonymous pl/sql block and get resultset in Java  Hello All, I would like to execute the anonymous pl sql block and need to get the resultset object. I got the code which can be done by using cursors inside the pl sql
query string
query string  Need some examples of query strings.send me as soon as possible. Regards, R.Santhosh
 

 

 

DMCA.com