Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6371573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:05:31+00:00 2026-05-25T01:05:31+00:00

public class Time extends javax.swing.JFrame { /** Creates new form Time */ public Time()

  • 0
         public class Time extends javax.swing.JFrame {

/** Creates new form Time */
public Time() {
    initComponents();
    generate();
}

public void generate()
{
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:timetable","sa","nish1990()");
    String str="select c_name from course where sem_id=1";
    Statement str1=con.createStatement();
    ResultSet res1=str1.executeQuery(str);

   // THIS THE RS PLACE 

    while(res1.next())
    {
        String s=res1.getString(1);
        JOptionPane.showMessageDialog(this,s);
    }

    }
    catch(SQLException e)
    {
        System.out.println("SQL Exception :: "+e.toString());
    }

    catch(Exception e)

    {
        System.out.println(e.toString());
    }  
}

public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {

        public void run() {
            new Time().setVisible(true);
        }
    });
}
// Variables declaration - do not modify
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField tf1;
private javax.swing.JTextField tf2;
// End of variables declaration
   }

SEE MY DATABASE CONTAINS THESE INFO :

C_NAME
C
COBOL
MATH

its able to retrieve all the data… i dont know how to split and display in text box..

rs.getString(1) contains C Cobol n Math …
so how do u take just C n display it
each of the item n display

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:05:32+00:00Added an answer on May 25, 2026 at 1:05 am

    rs.getString(1) contains C Cobol n Math … so how do u take just C n display it each of the item n display –
    if that’s what you’re asking then do something like this

        String s;   
    
        while(res1.next()){
           s=res1.getString(1);
        }
    
      String [] splitted = s.split(" ");
       for(String aSplit: splitted){
            System.out.println(aSplit);
       }
    

    I’m guessing you are not a fan of normalization. if you are then you don’t even have to split your data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please consider the following code: public class MyClass extends javax.swing.JFrame { private JTree jTree;
Here is the code: class Time { public static void printTime (int hour, int
I'm experiencing an intermittent problem with a class that extends javax.swing.text.DefaultStyledDocument . This document
I have this class which creates a grid: class GridPane extends JPanel{ public GridPane(int
This causes a compile-time exception: public sealed class ValidatesAttribute<T> : Attribute { } [Validates<string>]
Most of the time, I am doing this way. class a { public: ~
public class MyClass { public int Age; public int ID; } public void MyMethod()
public class Test { public static void main(String[] args) { } } class Outer
public class doublePrecision { public static void main(String[] args) { double total = 0;
public class CovariantTest { public A getObj() { return new A(); } public static

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.