-
July 12th, 2013, 04:26 AM
#1
Data type mismatch in criteria expression.
hi,
any one pls help me...i am getting the sql exception when running my code.
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
here is my code :
class submit extends Frame implements ActionListener
{
int num,no=0;
String name,addr,blgr,hist,pid,dob,current,room,dateadd,rtype,mf,docname;
public void actionPerformed(ActionEvent ae)
{
try{
num=Integer.parseInt(tftel.getText());
Statement st=cn.createStatement();
ResultSet rs=st.executeQuery("SELECT * FROM PAT WHERE contact="+num);
System.out.println(num);
if(rs.next())
{
no=rs.getInt("contact");
pid=rs.getString("patientno");
name=rs.getString("name");
addr=rs.getString("address");
hist=rs.getString("history");
dob=rs.getString("dob");
current=rs.getString("current");
blgr=rs.getString("bloodgroup");
room=rs.getString("roomno");
dateadd=rs.getString("dateadd");
rtype=rs.getString("rtype");
mf=rs.getString("gender");
docname=rs.getString("docname");
tfpno.setText(pid);
tfname.setText(name);
tfdob.setText(dob);
taadd.setText(addr);
tahis.setText(hist);
tacur.setText(current);
tfbg.setText(blgr);
tfroom.setText(room);
tfdateadd.setText(dateadd);
tfrtype.setText(rtype);
tfmf.setText(mf);
tfdocname.setText(docname);
}
}
catch(SQLException sq)
{
System.out.println(sq);
}
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|