PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 11th, 2003, 07:11 AM
as57 as57 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: canterbury
Posts: 6 as57 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Insert into Database

Help pls !

Having problems inserting into database

When complied passing error

E:\home\public_html>javac StaffidServlet.java
StaffidServlet.java:54: cannot resolve symbol
symbol : method insert (java.lang.String,java.lang.String,java.lang.String)
location: class Database2
db.insert(table, colNames, colValues);
^
1 error

Code:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.util.Date;
import java.sql.*;
import java.sql.Timestamp;
import java.lang.System.*;

public class StaffidServlet extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

PrintWriter out;

response.setContentType("text/html");

out = response.getWriter();

out.println("<html><body>");

/* This string parameters will capture information that is received from webpage and pass it through
the array */


String [] staffinfo = request.getParameterValues("staff_id");
String firstStaffinfo = staffinfo [0];

Database2 db = new Database2();

String [] staffresults = db.selectWhere("*", "staffmembers", "staff_id= '"+ firstStaffinfo +"'");


String [] fileinfo = request.getParameterValues("frefcode");
String firstFileinfo = fileinfo [0];

String [] fileresults = db.selectWhere("*", "file", "frefcode= '"+ firstFileinfo +"'");

long currentTime = System.currentTimeMillis();
Timestamp ts = new Timestamp (currentTime);

/* Insert into database*/



String table= "Loan";
String colNames= "(staff_id, frefcode, dateBorrowed)";
String colValues= "('" + firstStaffinfo +"'," + firstFileinfo + "," +ts.toString() +")";


db.insert(table, colNames, colValues);
out.println(ts);
out.println("<br>");

Thanks.

Reply With Quote
  #2  
Old March 18th, 2003, 09:39 AM
ishnid's Avatar
ishnid ishnid is offline
kill 9, $$;
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Sep 2001
Location: Shanghai, An tSín
Posts: 6,894 ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level)ishnid User rank is General 44th Grade (Above 100000 Reputation Level) 
Time spent in forums: 4 Months 2 Weeks 1 Day 22 h 14 m 53 sec
Reputation Power: 3885
Re: Insert into Database

Quote:
Originally posted by as57
Help pls !

Having problems inserting into database

When complied passing error

E:\home\public_html>javac StaffidServlet.java
StaffidServlet.java:54: cannot resolve symbol
symbol : method insert (java.lang.String,java.lang.String,java.lang.String)
location: class Database2
db.insert(table, colNames, colValues);
^
1 error

That's a standard Java error message. It means that your Database2 class doesn't have a method insert() that takes three strings as arguments. Have a look at your Database2 class.

~ishnid
PS - this should really be in the Java forum.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > Insert into Database

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap