473,395 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem with the database - regarding

hi..to all........
i used the following code... in order to check the input with the database...
but i had a error java.sql.SQLException: No data found
i checked the database name... and database connection... i dont know wats wrong ..... plz help me to resolve the problem......
Expand|Select|Wrap|Line Numbers
  1. try 
  2. {
  3.  
  4.       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  5.       con=DriverManager.getConnection("jdbc:odbc:prism");
  6.       stmt=con.createStatement();
  7.       rs=stmt.executeQuery("select * from Customerdetails");
  8.  
  9.  
  10.         s1=(ccod.getText());
  11.  
  12.       while(rs.next())
  13.      {
  14.          if(rs.getString("CustomerID").equals(s1))
  15.          {
  16.              flag=1;
  17.  
  18.            s1=(rs.getString(1));
  19.            s2=(rs.getString(2));
  20.            s3=(rs.getString(3));
  21.            s4=(rs.getString(4));
  22.            s5=(rs.getString(5));
  23.            s6=(rs.getString(6));
  24.            s7=(rs.getString(7));
  25.  
  26.            JOptionPane.showMessageDialog(this,new String("data found"+rs.getString(1)));
  27.  
  28.            ccod.setText(s1);
  29.            cname.setText(s2);
  30.            add.setText(s3);
  31.            phno.setText(s4);
  32.            conp.setText(s5);
  33.            email.setText(s6);
  34.            fax.setText(s7);
  35. }
  36.  
  37. }
  38. }
  39.  
  40.   catch(ClassNotFoundException e)
  41. {
  42.   System.out.println(e);
  43. }    
  44. catch(SQLException e)
  45. {
  46.   System.out.println(e);
  47. }
  48.  } 
Sep 28 '07 #1
5 1835
dmjpro
2,476 2GB
Look!

For maximum portability, result set columns within each row should be read in left-to-right order, and each column should be read only once.

So change this line.
Expand|Select|Wrap|Line Numbers
  1. JOptionPane.showMessageDialog(this,new String("data found"+rs.getString(1)));
  2. //This is wrong
  3. JOptionPane.showMessageDialog(this,new String("data found"+s1));
  4. //This is right
  5.  
So you got my point :-)
Good Luck !

Kind regards,
Dmjpro.
Sep 28 '07 #2
r035198x
13,262 8TB
hi..to all........
i used the following code... in order to check the input with the database...
but i had a error java.sql.SQLException: No data found
i checked the database name... and database connection... i dont know wats wrong ..... plz help me to resolve the problem......
Expand|Select|Wrap|Line Numbers
  1. try 
  2. {
  3.  
  4.       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  5.       con=DriverManager.getConnection("jdbc:odbc:prism");
  6.       stmt=con.createStatement();
  7.       rs=stmt.executeQuery("select * from Customerdetails");
  8.  
  9.  
  10.         s1=(ccod.getText());
  11.  
  12.       while(rs.next())
  13.      {
  14.          if(rs.getString("CustomerID").equals(s1))
  15.          {
  16.              flag=1;
  17.  
  18.            s1=(rs.getString(1));
  19.            s2=(rs.getString(2));
  20.            s3=(rs.getString(3));
  21.            s4=(rs.getString(4));
  22.            s5=(rs.getString(5));
  23.            s6=(rs.getString(6));
  24.            s7=(rs.getString(7));
  25.  
  26.            JOptionPane.showMessageDialog(this,new String("data found"+rs.getString(1)));
  27.  
  28.            ccod.setText(s1);
  29.            cname.setText(s2);
  30.            add.setText(s3);
  31.            phno.setText(s4);
  32.            conp.setText(s5);
  33.            email.setText(s6);
  34.            fax.setText(s7);
  35. }
  36.  
  37. }
  38. }
  39.  
  40.   catch(ClassNotFoundException e)
  41. {
  42.   System.out.println(e);
  43. }    
  44. catch(SQLException e)
  45. {
  46.   System.out.println(e);
  47. }
  48.  } 
The specs say that you should only read a values from left to right and and read them only once. You are reading from column one to seven then reading column one again. See if that doesn't affect it.
Sep 28 '07 #3
The specs say that you should only read a values from left to right and and read them only once. You are reading from column one to seven then reading column one again. See if that doesn't affect it.
Thanks... for your valuable suggestions...

i got the output.....


Regards
Pradeep
Sep 28 '07 #4
I CANT GET MY FRIENDS LIST 2,3 AND SO ON,,PLEASE HELP



Результаты 1-3 по запросу javascript:__doPostBack('ctl00$cpMain$pagerTop','2 ') (0,04 секунд)

Возможно, вы имели в виду: javascript:__doPostBack('ctl00$pcmain$pagetop','2' )



Пользовательский поиск
Q&A - [Myspace navigation]The link for page 2 is: javascript:__doPostBack('ctl00$cpMain$pagerTop','2 ') Since BrownRecluse has some javascript and forms ability I'm hoping that there ...
softbytelabs.com/us/support.pl?product=br&msg=177

jasmusic.com : Journal Listing... 2 of most listings because instead of <A href=""> I have to contend with dumb stupid shit like javascript:__doPostBack('ctl00$cpMain$pagerTop','2 '). ...
www.jasmusic.com/journal.php?skip=10&show=10

Parse a friends page on MySpace - ASP ForumThe question is, how do I get page 2 and page 3 and so on? There's a simple Javascript post on the ... javascript:__doPostBack('ctl00$cpMain$pagerTop','4 ') ...
www.thescripts.com/forum/thread595690.html

Возможно, вы искали: javascript:__doPostBack('ctl00$pcmain$pagetop','2' )
Sep 29 '07 #5
Nepomuk
3,112 Expert 2GB
I CANT GET MY FRIENDS LIST 2,3 AND SO ON,,PLEASE HELP



Результаты 1-3 по запросу javascript:__doPostBack('ctl00$cpMain$pagerTop','2 ') (0,04 секунд)

Возможно, вы имели в виду: javascript:__doPostBack('ctl00$pcmain$pagetop','2' )



Пользовательский поиск
Q&A - [Myspace navigation]The link for page 2 is: javascript:__doPostBack('ctl00$cpMain$pagerTop','2 ') Since BrownRecluse has some javascript and forms ability I'm hoping that there ...
softbytelabs.com/us/support.pl?product=br&msg=177

jasmusic.com : Journal Listing... 2 of most listings because instead of <A href=""> I have to contend with dumb stupid shit like javascript:__doPostBack('ctl00$cpMain$pagerTop','2 '). ...
www.jasmusic.com/journal.php?skip=10&show=10

Parse a friends page on MySpace - ASP ForumThe question is, how do I get page 2 and page 3 and so on? There's a simple Javascript post on the ... javascript:__doPostBack('ctl00$cpMain$pagerTop','4 ') ...
www.thescripts.com/forum/thread595690.html

Возможно, вы искали: javascript:__doPostBack('ctl00$pcmain$pagetop','2' )
This doesn't seem to have anything to do with the original Question and also this seems to be JavaScript instead of Java. Please open a new Thread about this in the JavaScript Forum.

Greetings,
Nepomuk
Sep 30 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
1
by: NohaKhalifa | last post by:
Dear All , I have a very big problem regarding using Arabic Character set . I'm Developing an Arabic Web Site using Asp and connecting to Access Database . but i have a problem retreiving data...
4
by: NohaKhalifa | last post by:
Dear All; I'm developing a web site and i need to make adminisration for this site it's a site for Real Estates . But I don't need the administration to be online .. I want them to fill data...
1
by: Christian W. Guenther | last post by:
Hallo, please excuse if I violate any group etiquette etc. but I am not very experienced both regarding the usenet and your group. I have installed Xindice, integrated into Tomcat, and can use...
10
by: Saso Zagoranski | last post by:
hi, this is not actually a C# problem but since this is the only newsgroup I follow I decided to post my question here (please tell me where to post this next time if you think this post...
23
by: cmd | last post by:
I use the following code (behind a command button on the FE) to relink from a user's local copy of the BE to the file-server's BE on our LAN. I use this, for example, when a person brings in their...
1
by: vasilip | last post by:
Can anyone help me out with these two issues I seem to be having? using the db2 driver for PHP (db2_xxxxxx) functions 1. If I forget, or for some reason db2_commit/db2_rollback doesn't get...
0
by: mahesh123 | last post by:
Hi, I am new to use the crystal reports8.0. I am facing the problem regarding the database connection through the ADO Connection. Suppose my database name is "sample.pra"(due to some security...
2
by: RajSharma | last post by:
Hi, I am facing a problem regarding querying thru a large table having millions of rows....... Its hanging in between while querying for all those rows Can anybody suggest me a query regarding :...
2
by: dm3281 | last post by:
Hi all -- I have a strange issue. I have obtained a scripted database and compiled ASP.NET 2.0 application from a sister site that I'm trying to implement locally. I have successfully...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.