473,385 Members | 1,673 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,385 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 1669

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: 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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.