Peter Harvey

Greenhorn
+ Follow
since May 28, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Peter Harvey

It did the trick! Thanks!
22 years ago
I have the following problem with a JPanel:
I am currently getting information from a database and displaying it in a JTable. Rather than make my own TableModel, I simply create a new JTable, remove the old JTable, and put the new one in its place.
In order to do this, I set the first JTable to null, call the JPanel's repaint method to get rid of it, add the new JTable, and call repaint again to show it. The problem is, the new JTable doesn't appear unless I click somewhere on the application. I've tried using a Graphics object to repaint it manually, but it tells me that those methods are protected and that I don't have access to them, even though I'm using an instance JPanel.
What am I doing wrong? I can't figure it out.
22 years ago
Is there any way to get the ID of an event in Swing? I know that in the old event-handling way of doing things you could get the ID of an event (gotFocus, lostFocus, etc) but in the new way I can't find any. I can get the source, but that's not what I want.
Am I looking too hard, or not looking hard enough?
22 years ago
FINALLY!!
I figured it out! It turns out that you're not allowed to name a column 'Date' in MS-Access. I just renamed the column, and everything works fine.
I swear, I almost cried when I figured it out. And all this time I figured it was a Java problem.
Excuse me while I glue back the hair which has been torn out over the last two days...
Nothing works. I tried using a prepared statment, tried using Date and Time objects without the prepared statement, still no go. My sql looks fine to me, but I still get the same error. The Date field in MS Access is Date/Time(Short Date) and the Time field is Date/Time(Medium Time).
I'm at the point now where I'm probably just going to make three fields for Date (month, day, and year), and the same for Time (hour, minute, second), all ints. I probably should have done this first, but I wanted to learn the proper way to do it. Guess it serves me right.
Thanks for the Calendar lesson, though. I learned a lot from it.
You can still take another crack at my problem if you want.
Nope. Insert into Schedule (Date, Team, Time) values ('2001-5-6', 10, '6:55:00') still produces
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Still open to suggestions ...
Hi, Everyone.
I have the following problem: I am trying to insert data into a table called Schedule where the fields are Date, Team, and Time.
Date has to be formatted like 6/18/01, Team is a Number, and Time has to be formatted like 6:55 PM. My sql looks like this:
Insert into Schedule (Date, Team, Time) values (6/18/01, 10, 6:55 )
That's taken directly from the screen (I print out all my queries before they're executed). I can put single quotes (') around the date and time, leave 'em off one, put 'em on the other, etc., etc., but no possible combination seems to work. I also tried adding the PM to the time, both with and without ' ' , but no go.
What am I doing wrong?
Thanks, Aleksey.
At least now I have a starting point. Before now, I felt like I was stumbling around in the dark.
This are the things which they don't teach in school, but should.
Maybe JavaRanch should have a slogan: "Where school leaves off, we begin..."
Thanks, guys!
Yet another reason why JavaRanch rocks!
Ravikiran, you're missing my point. I know all about the benefits of education. I'm not asking about what the certification is worth. I want to know what I should charge people if I go into business for myself, not what one specific project is worth. In order to evaluate a pay scale, one must first have a starting point. It can be a low starting point and work upward, or a high point and work downward, but a starting point is needed. Since the developer project is a basic one, I figured it would be a good point to start with. As a person who has a lot of creditials but little actual experience, I know all about learning for learning's sake. What I need to know now is how much a company is willing to pay for a project, and the developer project is as good as any to begin with.
It wouldn't hurt any of us if we found out what we are worth. And just because a person would like to find out their market value, that doesn't make them greedy. It makes them practical. Free love is great, but it doesn't pay the bills. When you consider the number of unemployed students who use this forum, a little bit of practical advice could help a lot of people.
Sorry to run on, but when I started this post, I figured that I wouldn't get a straight answer, and I was right. Don't take any comments personally. You just happened to be the one who said what everyone else was thinking.
Below is the exact code for a function, where sections[1] is a JComboBox, and levels is a String which equals "1". The Statement and the ResultSet are global variables which work fine.
private void fillSectionCombo(String levels) throws SQLException
{
String query="Select Section from Section where Section like '" + levels + "*'";

statement=conn.createStatement();
results=statement.executeQuery(query);
boolean more=results.next();
while(more==true)
{
sections[1].addItem(results.getString("Section"));
more=results.next();
}
}

The query is actually ends up looking like this:
Select Section from Section where Section like '1*'
The table Section exists, and the field Section exists within it. There are also plenty of entries which begin with '1' (101, 102, etc).
What am I doing wrong? results.next() returns false. I just don't understand why.
I was really hoping to get an actual number. Are we talking <$1000, >$1000, <$500, >$500, etc, etc.? Just a range will do, something I can wrap my head around.
I was just wondering what the Java developer project was worth in the real world, ie what a software company would charge for such a project (not that I'd ever ask anyone to do it for me. I just want to find out what it's worth.)