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



Home Answers Viewqa JDBC correct the sql error and retrive data....plez
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Ocean Pearl
correct the sql error and retrive data....plez
0 Answer(s)      2 years and 8 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());
     }
 }

}

plez plez plez help me its my assignment....... and thanks for all your help.....


Advertisement
View Answers

Related Tutorials/Questions & Answers:
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 in criteria expression" plez do help me and studentId's datatye is number
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
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
java [ cannot retrive date from sql ] why??
cannot I retrive data from bd even if I put correct data in it if( rs.next...java [ cannot retrive date from sql ] why??   import...(); } }   Hi, Try to print the sql on console and then run
insert and retrive data and time - SQL
insert and retrive data and time  hello everybody . Is there any method in java so that we can insert current system time and then it can be retrieve that date and time from database ? ..........................  
insert and retrive image from sql server database in jsp
insert and retrive image from sql server database in jsp  what is the code to insert and retrive an image from sql server database in jsp
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
retrive article from sql databse and show using php
retrive article from sql databse and show using php  hello sir i have sql database which i store articles.i want to show these article on web page using php. my field are image,title,summary,content id. plz provide me
SQL Error Version 5.5.15
SQL Error Version 5.5.15  SQL Error Version 5.5.15
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..._UserType+",'"+user_password+"');"; AND THE DATA WHICH IS INSERTED FROM THE FORM IS THROWING THE ERROR OF INVALID CHARACTER BUT THE SAME QUERY IS RUNNING
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
hibernate sql error - Hibernate
hibernate sql error  Hibernate: insert into EMPLOYE1 (firstName, lastName, age, p-type, EMP_ID) values (?, ?, ?, 'e', ?) Exception in thread "main.../index.shtml http://www.roseindia.net/hibernate/insert-data-database.shtml Hope
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
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
File Upload and Retrive files
File Upload and Retrive files  Can any body help me am getting an error in uploading file. into mysql database.... thank's in advance
Retrive Values
Retrive Values  I want to retrive the values between the td by the id using the javascript.So please help me... html form like this <TABLE...; </TABLE> And I want to retrive Cell 1,Cell 2,Cell 3
syntax error in SQL Insert Statement - Java Beginners
syntax error in SQL Insert Statement   private class ButtonListener implements ActionListener{ public void actionPerformed(ActionEvent ae...); stm.executeUpdate();*/ JOptionPane.showMessageDialog(null,"Data
Java servlet sql connectivity error - JSP-Servlet
to store data into sql database the connection does not get established. I am...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
how to retrive
; it's not working..ple anybody can correct is code
store and retrive image from the database
store and retrive image from the database  please provide me... to store and retreive images from sql database using sql commands -how to store and retreive images from sql database using asp.net/c# thanks in advance
retrive values - JSP-Servlet
retrive values  how to get multiple values from html to jsp
retrive values - JSP-Servlet
retrive values  how to retrive multiple values from html to jsp  Hi Friend, Try the following code: 1)calljsp.html: Enter Name: Enter Address: Gender:MF Qualification: Btech MBA MCA MSC
 

 

 

DMCA.com