Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

alert box not working on database query

Status
Not open for further replies.

johnv20

Programmer
Sep 26, 2001
292
US
Hi,
I need to have a page which checks against a database query to see if a barcode has already been entered and display an alert box if this is the case.

While I can get Response.Write to display the correct msg I cannot get the alert fn to work could someonr please help

<%@ Language=JavaScript %>
<%

var findit = &quot;emrtest1.asp&quot;;
var bcode = String(Request(&quot;bcode&quot;));
%>
<!-- #include file=&quot;dsn1.js&quot; -->
<%
var que = &quot;select BarCode from SUTProperty where BarCode = '&quot;+ bcode +&quot;'&quot;;
rs = Server.CreateObject(&quot;ADODB.RecordSet&quot;);
rs.Open (que, Conn);
while (! (rs.EOF))
{
var b2code = String(rs.fields.item(&quot;BarCode&quot;));
rs.move(1);

} // end while recordset

if (b2code == bcode)
{
alert(b2code + 'BarCode is invalid');
}
 
Try something like this:


Response.Write (&quot;<script>alert('&quot; & Request.Form(&quot;FName&quot;) & &quot; &quot; & Request.Form(&quot;LName&quot;) & &quot; has been deleted.')</script>&quot;)

Now, in order to use what I have above you'll need to submit to a new page or back to the page you're on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top