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 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 Tutorials/Questions & Answers:
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
Advertisements
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
SQL Error Version 5.5.15
SQL Error Version 5.5.15  SQL Error Version 5.5.15
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
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
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
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
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
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
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
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
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
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
MY Sql Query Error - Not able to Understand the issue
MY Sql Query Error - Not able to Understand the issue  I am new... END I am getting an error as follow: Schema Creation Failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
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
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
Java Compilation error - SQL
error
/ServletUserEnquiryForm.shtml getting an error given below SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error please suggest...error  I am running a program insert into statement in sql using
ModuleNotFoundError: No module named 'correct-horse'
'correct-horse' error? Thanks   Hi, In your python...;correct-horse' error will be solved. Thanks...ModuleNotFoundError: No module named 'correct-horse'  Hi, My
ModuleNotFoundError: No module named 'correct_pycountry'
named 'correct_pycountry' error? Thanks   Hi, In your...: No module named 'correct_pycountry' error will be solved. Thanks...ModuleNotFoundError: No module named 'correct_pycountry'  Hi, My
ModuleNotFoundError: No module named 'reynir-correct'
'reynir-correct' error? Thanks   Hi, In your python... 'reynir-correct' error will be solved. Thanks...ModuleNotFoundError: No module named 'reynir-correct'  Hi, My
ModuleNotFoundError: No module named 'correct-horse'
'correct-horse' error? Thanks   Hi, In your python...;correct-horse' error will be solved. Thanks...ModuleNotFoundError: No module named 'correct-horse'  Hi, My
ModuleNotFoundError: No module named 'correct_pycountry'
named 'correct_pycountry' error? Thanks   Hi, In your...: No module named 'correct_pycountry' error will be solved. Thanks...ModuleNotFoundError: No module named 'correct_pycountry'  Hi, My
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
error
error  while iam compiling iam getting expected error
Error-
Error-   Hello, I would like to know about XSD file. I try to print XML file but I am getting error SAXException-- says Content is not allowed in prolog. Please help me
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  i have 404 error in my program plz tell me yhe solution about
Error
Error  I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'. This error come only in IE browser, but in other brower
error
error  java.lang.unsupportedclassversionerror:bad major version at offset 6 how to solve this????   Hi, Please check the version of framework used and also the JDK version.ADS_TO_REPLACE_1 This type error also comes
error
error
error
error  When I deploye the example I have this message cannot Deploy HelloWorld Deployment Error for module: HelloWorld: Error occurred during deployment: Exception while deploying the app [HelloWorld
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error
"+it); } } this is my program i am getting an error saying cannot find symbol class stringADS
error
error  whats the error.............. import java.util.Scanner; public class g { public static void main(String[] args) { Scanner s=new Scanner(System.in); int d,x,y; System.out.println("Enter the first number
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
sql
difference between sql and oracle  what is the difference between sql and oracle
sql
sql  how to get first row in sql with using where condition in sql? how to get last row in sql with using where condition in sql
Correct errors - Java Beginners
Correct errors  Identify and correct the errors in the following program: public java Method { public static method1(int n, m) { n += m; xMethod(3. 4); } public static int xMethod(int n) { if (n > 0) return 1

Ads