Home Answers Viewqa JDBC correct the sql error

 
 


Ocean Pearl
correct the sql error
0 Answer(s)      a year and 3 months ago
Posted in : JDBC

i am getting a SQL Error while retriving data from access to jframe called "datatype mismatch in criteria expression" plez do help me and studentId's datatye is number......

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
     if(jTextField1.getText().equals(""))
 {
     JOptionPane.showMessageDialog(null,"Please enter the Student ID to Search","Error",0);
 }
 else
 {
     try
     {
         String ID=jTextField1.getText();


         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con=DriverManager.getConnection("jdbc:odbc:college");
         Statement st=con.createStatement();
            ResultSet rs=st.executeQuery("select * from STUDENT where studentid='"+ID+"'");

            while(rs.next()){
            jTextField1.setText(rs.getString("studentid"));
            jTextField2.setText(rs.getString("name"));
            jComboBox1.setSelectedItem(rs.getString("course"));
            jComboBox2.setSelectedItem(rs.getString("sem"));
            jTextField4.setText(rs.getString("father"));
            jTextField5.setText(rs.getString("mother"));
            jTextField13.setText(rs.getString("dob"));
            jTextField6.setText(rs.getString("contactno"));
            jTextField7.setText(rs.getString("nationality"));
            jTextField8.setText(rs.getString("religion"));
            jTextField9.setText(rs.getString("caste"));
            jTextArea1.setText(rs.getString("address"));
            jTextField10.setText(rs.getString("foccupation"));
            jTextField11.setText(rs.getString("moccupation"));
           jTextField12.setText(rs.getString("income")); 

            }
            JOptionPane.showMessageDialog(null,"Searched Successfully");
            rs.close();
            st.close();
            con.close();
     }
    catch(SQLException sqlex)
     {
        JOptionPane.showMessageDialog(null,"SQLExceptionOccurred"+sqlex.getMessage());
     }
     catch(ClassNotFoundException cnfex)
     {
         JOptionPane.showMessageDialog(null,"ClassNotFoundExceptionOccurred"+cnfex.getMessage());
     }
 }

}

and thanks for all your help.....

View Answers









Related Pages:
correct the sql error
correct the sql error  i am getting a SQL Error while retriving data from access to jframe called "datatype mismatch in criteria expression" plez do...(null,"Please enter the Student ID to Search","Error",0); } else { try
correct the sql error and retrive data....plez
correct the sql error and retrive data....plez  i am getting a SQL Error while retriving data from access to jframe called "datatype mismatch...("")) { JOptionPane.showMessageDialog(null,"Please enter the Student ID to Search","Error",0
what error in this program plese correct it
what error in this program plese correct it  import java.io.*; class y { public static void main (String args[]) { Data inputStream dis = new Data inputstream(System.in); float l,b,a; Systyem.out.println("enter the lengh"); l
SQL Error - SQL
SQL Error  Invalid character value for cast specification on column number 5 (Designation) Whats this error about this if the field i specified in programming error. ie DB fields in above question
NullPointerException - SQL
sql string to make double check that query is correct. and when I try to run it with calling bean function data.Set_Info(sql);--inside function -> st... are not null, I check them with print them out. String sql = "UPDATE preview SET
sql syntax error help
sql syntax error help  this query show syntax error .. i am unable to figure it out insert into order (orderdate, dpname, paymethod, tamount...') where is the error ?   Please send the error details and the datatype
SQL connection error in android
SQL connection error in android  hi, i am android developer . recently i made one application connect with sql server 2005 using jtds...:sql:Exception : BUFFERDIR connection property invalid. if you have any answer
plz check my codings are correct or not...There is an error..i cant find it..
plz check my codings are correct or not...There is an error..i cant find it..  import java.util.Scanner; public class Student { private String indexNo; private String gender; private char initial; private int mark1
error : not an sql expression statement
error : not an sql expression statement  hii I am gettin followin error in connecting to database SQLserver 2005 in Jdeveloper,i m usin struts and jsp my pogram: import java.sql.*; public class TaskBO { public TaskBO
JSP SQL Error
JSP SQL Error  Hi While trying to execute the below code i'm getting the following error "java.sql.SQLException: Io exception: Got minus one from a read call ". please help me out. <% try{ String Username
SQL QUERY ERROR
SQL QUERY ERROR  Im writing a query which shows error of INVALID... THE FORM IS THROWING THE ERROR OF INVALID CHARACTER BUT THE SAME QUERY IS RUNNING..._value'. . .); For more information, visit the following link: SQL Queries
SQL error - JSP-Servlet
SQL error  Hello friends, Can we update a column with referrence to that column value. For example, the query...){ System.out.println("Error occured while updating!!!"); } con.close
foreign key error in sql
foreign key error in sql  create table matchdetails(mid varchar2(10),mdate date,team1 varchar2(10),team2 varchar2(10...) references matchdetails(mid)); ->for the above batsman table it shows error
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern = /^\d{3,5
hibernate sql error - Hibernate
hibernate sql error  Hibernate: insert into EMPLOYE1 (firstName, lastName, age, p-type, EMP_ID) values (?, ?, ?, 'e', ?) Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
How to trap Trigger Error - SQL
problem?.. Is there a way in where I can trap all SQL error and place it under... error_log ( timestamp DATETIME, username NVARCHAR(30), ErrorID INT, database_name NVARCHAR(50), error_stack
plz Help me find the correct programs answers
plz Help me find the correct programs answers   Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff...) { System.out.println("Error:::" + e); } } }   For Bank Problem
SQL - SQL
combobox Can u please tell me how to do it i tried but it is giving me error
connect with Database - SQL
..i m getting error .. Failed to get a connection...=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))); - nested throwable...=)(VSNNUM=169869568)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4
SQL Query - JSP-Servlet
SQL Query   AS mysql backend updation query shows a syntax error. I gave the full query and the generated error here. Please send me the correct...+"'"); Generated error: Unknown Exception occured java.sql.SQLException
My Sql Error - Development process
My Sql Error  Hello Sir ,I have Created Table with following Query,then Table Created Succefully,But some errors Occured, can u give me the Code with Microsoft Access As BackEnd Application in this Project . plz Help me Sir
syntax error in SQL Insert Statement - Java Beginners
syntax error in SQL Insert Statement  Dear Sir ,I have write following code to save data into access databse, but code gives following error code...)values(?,?)"); Error: java.sql.SQLException: [Microsoft][ODBC Microsoft
Error while SQL Server connection to Java
Error while SQL Server connection to Java  import java.sql.*; public..."); con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER;user=DTHOTA;password...("password", " "); con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER", prop
Error while SQL Server connection to Java
Error while SQL Server connection to Java  import java.sql.*; public..."); con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER;user=DTHOTA;password...("password", " "); con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER", prop
Java servlet sql connectivity error - JSP-Servlet
Java servlet sql connectivity error  Hi, I have been trying to connect to sql database via the servlet program in java.I have not been successful so far. However when i try to connect to sql through a normal java program
SQL
SQL       SQL SQL is an English like language consisting of commands to store, retrieve, maintain & regulate access to your database. SQL*Plus SQL*Plus
insertion in SQL - SQL
insertion in SQL  Hi! Everybody... i have a problem with sql.... it is showing error. invalid syntax near.. i know that we are not supposed to place... on Insert Query visit to : http://www.roseindia.net/sql/insert.shtml Thanks
Produces XML file but format not correct for storing data using JSP and XML
Produces XML file but format not correct for storing data using JSP and XML  hii I have created a project using JSP and XML as database to store data... the following error also: XML-22900: (Fatal Error) An internal error condition occurred
syntax error in SQL Insert Statement - Java Beginners
syntax error in SQL Insert Statement   private class ButtonListener implements ActionListener{ public void actionPerformed(ActionEvent ae){ //tab1 if(ae.getSource()==bt1ok){ // String date
Syntax error in my UPDATE..please advise
. Tks.  Here is correct format: String sql = "UPDATE members SET...Syntax error in my UPDATE..please advise  Hi experts, I tested my code and NetBean IDE gave me the following message:- You have an error
Identify correct and incorrect statements or examples about EJB programming restrictions.
Identify correct and incorrect statements or examples about EJB... Overview Next     Identify correct and incorrect statements... manager; stop the JVM; or change the input, output, and error streams
programming error
programming error  I got an error when i did the following program the prg. is to "select the name from database when the age is given for the respective name" error i got is:SQL exception please give me the solution by providing
Error in servlets
Error in servlets  I cant execute my servlet or jsp programs. Im getting an error resource not found. I am using tomcat 6.0. I have set the path and class path correctly. My code is also correct. I have done everything but i
PHP SQL Quotes and Quoting
will be as follows, which is absolutely correct according to the Sql syntax.  ... according to the Sql syntax. So it shows fatal error in the page... PHP SQL Quotes and Quoting     
annotation error
the correct name with javac command. Here we have used your specified classname
sql - JDBC
sql  java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'origin=:src destination=:dest'. what's the solution for that problem
sql - JDBC
sql  java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'origin=:src destination=:dest'. what's the solution for that problem
sql - JDBC
sql  hi am keerthi java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Source=:src Destination=:dest'. am working with this from last 2 days plzzz anybody give
Code error
) read.close(); } } } While using this it shows error as: run... seconds) Hw can i correct this code????????   Basically, the Exception
SQL Exception
SQL Exception  I want stores data in to the databse table but it can't be stores it shows an error about sql exception. blackberry.html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org
java,sql
,"Error in submitting data!"); } } }); viewbtn.addActionListener(new...(Exception ex){ JOptionPane.showMessageDialog(p2,"Error in updating edit fields"); } } } catch(Exception ex){ JOptionPane.showMessageDialog(p2,"Error
BLOB - SQL
To Display image"); out.println("Image Display Error=" + e.getMessage
Error - JDBC
Page"); } else{ out.println("Please enter correct
Error processing
Java: Error processing Error in user input or action If the user makes an error in input, give the appropriate feedback, and allow them to correct... to correct their problem. I recently used a program that produced "Error
Free Java Is it correct?
Free Java Is it correct?  Hi, Is Java free? If yes then where I can download? Thanks   Hi, You can download it from http://www.oracle.com/technetwork/java/javase/downloads/index.html Thanks
Identify correct and incorrect statements or examples about the client's view of exceptions received from an enterprise bean invocation.
Identify correct and incorrect statements or examples about...; Identify correct and incorrect statements or examples about the client's view... the enterprise bean without a transaction context. This error usually indicates

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.