Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 10-25-2005, 07:57 PM   #1 (permalink)
kkiub
Registered User
 
Join Date: Oct 2005
Posts: 3
kkiub is on a distinguished road
movefirst in java

hi guys,

i need your help. i need to point cursor to my first record in my resultset. but no function movefirst in java. this in my code:
Code:
public SPO RetrievePOHdr (String cSQL) throws RemoteException {
    SPO PO = new SPO();			
    try {
	  DBConnection dbconn = new DBConnection ();
	  stmt = dbconn.getConn().createStatement();
	  sql = "SELECT * ";
	  sql = sql + " FROM pu_ordhdrfc, outer pu_ordlinefc ";
	  sql = sql + " WHERE puoh_company = puol_company ";
	  sql = sql + " and puoh_ordid = puol_ordid ";
	  sql = sql + cSQL;
	  rs = stmt.executeQuery(sql);
	  rs.movefirst(); --- error
	  String ordDate,expDate;
	  DateConvert dc = new DateConvert();
	  ordDate= dc.getStrdate((rs.getString("puoh_orddate")),"DBtoJSP");
	  expDate= dc.getStrdate((rs.getString("puoh_expdate")),"DBtoJSP");
	  PO.setcompany(rs.getString("puoh_company"));
	  PO.setordid(rs.getString("puoh_ordid"));
	  PO.setcontractid(rs.getString("puoh_contractid"));
	  PO.setsuppid(rs.getString("puoh_suppid"));
    }catch (SQLException ee) {
      System.out.println("error retrieve:" +ee);
    }
    return PO;
}
please help me.

Last edited by Belisarius; 10-26-2005 at 01:02 AM. Reason: Beautified code
kkiub is offline   Reply With Quote
Old 10-26-2005, 01:08 AM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,166
Belisarius is on a distinguished road
You probably want "next()" rather than "movefirst()" (which, incidently, doesn't exist and is misspelled at any rate).

By calling "next()", you'll move the cursor to the first row of the ResultSet, and be able to access it's values. Any subsequent calls of "next()" will move the cursor down one until it hits the end, at which point it'll return "false".
__________________
GitS
Belisarius is offline   Reply With Quote
Old 10-26-2005, 05:23 PM   #3 (permalink)
kkiub
Registered User
 
Join Date: Oct 2005
Posts: 3
kkiub is on a distinguished road
Smile

thank you so much
kkiub is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Resources Belisarius Java 0 03-28-2005 02:03 PM
Java Developer Position in Kansas City justplaindoug Java 0 10-29-2004 11:52 AM
IBM urges Sun to make Java open source redhead Code Newbie News 0 03-01-2004 10:39 PM


All times are GMT -8. The time now is 05:11 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting