|
I appreciate all of your help... I finally got the
prepared statement down through all your help.. However, it is still choking on
a LONG string. It inserts strings with any kind of character (which was a
problem before), but it wont update a string that is very large. Any
suggestions? I hope I am not abusing the list by making so many posts, but
you guys have been my best resource. Code is below...
Thanks, Greg Price
<%@ page language="java" import="java.sql.*,
java.util.*" %>
<% String heading= request.getParameter("heading"); %> <% String entry= request.getParameter("entry"); %> String sqlQuery = "INSERT INTO news (newsletter_ID, heading, entry) VALUES (?, ?, ?) "; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:afdallas"; Connection c=DriverManager.getConnection(url, "sa", ""); try { PreparedStatement pstmt = c.prepareStatement(sqlQuery); pstmt.setInt(1,Integer.parseInt(request.getParameter("newsletter_ID").trim()) ); pstmt.setString(2, heading.trim() ); pstmt.setString(3, entry.trim() ); pstmt.executeUpdate(); pstmt.close(); c.close(); } catch(Exception exc)
{
System.out.println("Error: "+exc); }%> |
- Re: Memo Insert Again Gregory Price
- Re: Memo Insert Again Richard Yee
- Re: Memo Insert Again Ron van Pol
