|
Hi Greg,
As Ashish brought up, used PreparedStatement.
The overall idea is to use SQL Server's stored procedures, which accept values
from the calling tier (front-end, or middle-tier). In ASP it's quite
simple, using ADO's capabilities. Is there a JSP or Servlet equivalent, is
the question to ask. Answering this would solve any and ALL data transfer
issues between jsp/servlets and any Microsoft Servers (either SQL Svr, Access
2000/XP, or .NET's data handling... in general).
Sorry to not be much more of help, as I am learning
JSP and Servlets myself. There's GOT to be an ADO equiv,
though.
Nasser
"Unemployed by trade"
----- Original Message -----
Sent: Monday, August 20, 2001 11:35
AM
Subject: sql server insert
Hello, I am running Jrun and have run into a
problem submitting a long string.
The long string a user submits will likely be in
French, which means a lot of single and double quotes. I am now
able to submit this field under normal circumstance, but my code is choking
on these characters... I bet you guys can nail this one
pretty quick... I must need a function when I set that large string
as a variable... Your help is very much appreciated. code is
below:
<%@ taglib uri="jruntags" prefix="jrun" %>
<%
String news_ID= request.getParameter("news_ID"); %> <% String
newsletter_ID= request.getParameter("newsletter_ID"); %> <% String
heading= request.getParameter("heading"); %> <% String entry=
request.getParameter("entry"); %> <% String
enteredby=request.getParameter("enteredby"); %> <% String
newslettermonth= request.getParameter("newslettermonth"); %> <%
String newsletteryear= request.getParameter("newsletteryear"); String
sqlQuery = "INSERT INTO news (newsletter_ID, heading,
entry, enteredby) VALUES (" +newsletter_ID + ",
'" +heading+ "', '" +entry+"', '" +enteredby+"')";
%>
<%--INSERT NEWSITEM--%>
<jrun:sql datasrc="afdallas" id="allnews">
<%=sqlQuery%> </jrun:sql>
Thanks
Greg
Price
|