473,323 Members | 1,547 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,323 software developers and data experts.

This doesnt give a resultSet but it updates the db

Sl1ver
196 100+
That is my code, if i put a updateQuery statement in there, then it updates my database, but when i query the database then it doesn't populate the resultset

Expand|Select|Wrap|Line Numbers
  1. public ResultSet User(String user)
  2.     {
  3.         ResultSet st = null;
  4.         try
  5.         {
  6.             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  7.             dbConn = DriverManager.getConnection("jdbc:odbc:user");
  8.             statement = dbConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
  9.  
  10.             String sql = "Select user_id, user_name, user_password from user where user_name like '*"+user+"*'";
  11.  
  12.             resultSet =  statement.executeQuery(sql);
  13.             if(resultSet.next())
  14.             {
  15.                 st = resultSet;
  16.             }
  17.             if(!resultSet.next())
  18.             {
  19.                 String sqlAll = "Select * from user where user_name like '*"+user+"*'";
  20.                 resultSet = statement.executeQuery(sqlAll);
  21.                 st = resultSet;
  22.             }
  23.  
  24.         }catch(ClassNotFoundException cf)
  25.         {
  26.  
  27.         }catch(SQLException ex)
  28.         {
  29.             System.out.println(ex.toString());
  30.         }
  31.         return st;
  32.     }
  33.  
Nov 7 '10 #1
0 1667

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

Similar topics

6
by: effendi | last post by:
I have a page with checkboxes generated by a script. Users are suppose to select the checkboxes and click on a button to process their selection. The codes work fine except when I only have one...
3
by: Vaddina Prakash Rao | last post by:
Hello every one, In our Linux Encoding system, a copy of helix dna producer is running ..... i wrote an applicatoin which can remotely communicate with the encoding machine ... Its function...
13
by: nigel.t | last post by:
Using linux <?php exec("/bin/tar -cvzf myfile.tgz /home/",$arrayout,$returnval); ?> or perhaps try it on your system and tell me if it does/doesnt and what your linux is? I've also tried
13
by: Paul Melis | last post by:
Can someone explain to me why the following code compiles without errors on gcc 4.0.2? void f() { } void t() { f(1,2,3);
5
by: jodleren | last post by:
This line while(!adminok && ($i>=0)) was missing a $-sign, should be while(!$adminok && ($i>=0)) Though, it did not give an error, and I do not have any adminok elsewhere... so how come,...
19
by: uhdam | last post by:
Hai... I need to have image as tooltip. Is it possible. If yes how. I dont want to use applet. When i scroll over the label in my frame the pop up containing the image should be displayed. How can...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.