3 Replies - 794 Views - Last Post: 29 July 2009 - 10:19 PM Rate Topic: -----

#1 DivineGuardian   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 28-July 09

Need help in retrieving time value from odbc. Enter here.

Post icon  Posted 28 July 2009 - 07:23 PM

Hi all,
I need example on how can i go about retrieving time value from odbc.

So far i am able to insert into odbc using the following codes below:
 
String stime=getHoursComboBox().getSelectedItem().toString() + ":"+
			getMinsComboBox().getSelectedItem().toString()+":"+getSecondsComboBox().getSelectedItem().toString();
			Time startTime= Time.valueOf(stime);



Those code i posted in the code box are actually 3 combo boxes in the format of hh,mm,ss. So example if the administrator done selecting and when he/she hit create. the value selected from the combo boxes will be casted into a time object and passed it thru java sql command into MS access.

As for now, i dont know how to retrieve the time value in MS access back into java swing combo boxes for updating.

Really appreciate it if someone would be able to help me out here.


Is This A Good Question/Topic? 0
  • +

Replies To: Need help in retrieving time value from odbc. Enter here.

#2 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: Need help in retrieving time value from odbc. Enter here.

Posted 28 July 2009 - 07:47 PM

Let me fetch my sun glasses first
Was This Post Helpful? 0
  • +
  • -

#3 g00se   User is online

  • D.I.C Lover
  • member icon

Reputation: 3703
  • View blog
  • Posts: 16,976
  • Joined: 20-September 08

Re: Need help in retrieving time value from odbc. Enter here.

Posted 29 July 2009 - 12:59 AM

Use a PreparedStatement:

String sql = "select * from x where some_time_col = ?";
PreparedStatement ps = connection.prepareStatement(sql);
ps.setTime(1, startTime);
ResultSet rs = ps.executeQuery();



btw, be careful with your fonts in future, i had to answer that while looking through the wrong end of a pair of binoculars

This post has been edited by g00se: 29 July 2009 - 01:02 AM

Was This Post Helpful? 0
  • +
  • -

#4 DivineGuardian   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 28-July 09

Re: Need help in retrieving time value from odbc. Enter here.

Posted 29 July 2009 - 10:19 PM

Ok, i will try that out. Hopefully will work. Will notify here again once i tried it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1