This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes how i pass recordset value to string variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how i pass recordset value to string variable" Watch "how i pass recordset value to string variable" New topic
Author

how i pass recordset value to string variable

muhammad fahim
Ranch Hand

Joined: Dec 17, 2006
Posts: 45
hi master

sir how i pass table column value into string variable

see my code but not run

====
import java.sql.*;
public class Waheed {
public Waheed() {
}
public static void main (String args [])
{
String s = "9 23 45.4 56.7";

System.out.println ("going for connection");
// DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc racle:thin:@fahim:1521:aamir","muhammad","mfa786");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select accid from accbal");
System.out.println ("going for connection");
while (rset.next())

s= rset.getString("accid"); this line give me error

System.out.println (rset.getString("accid"));
System.out.println (s);
}
catch(Exception e){
e.printStackTrace();
}
}
}


sir only this line give me error

s= rset.getString("accid"); this line give me error

s is string variable

plese give me idea how i pass accid in s variable

thank

aamir
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Please provide the exact error message.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
muhammad fahim
Ranch Hand

Joined: Dec 17, 2006
Posts: 45
thank's for yur reply

sir i solve that problem

my next problem regarding grid

how i use grid in applet becuase i have mulitpul record how i show that all record in applet grid

please give me idea how i how my all record in applet grid

thanks

aamir
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how i pass recordset value to string variable