Hi,
I encountered similar problem. I recommend to construct query string
dynamically, without PreparedStatement.

Regards,
Vitaly.

----- Original Message -----
From: "Gregory Price" <[EMAIL PROTECTED]>
To: "JRun-Talk" <[EMAIL PROTECTED]>
Sent: Friday, August 31, 2001 7:59 PM
Subject: Memo Insert Again


> 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);
>     }%>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to