473,472 Members | 2,247 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Cannot Alert

Dear all,

I have the following code which add a new record to
database, after the record has been added. I want to prompt a message
"Hello". But the following script does not promt.
Response.Write("<script>")
Response.Write("alert (""Hello"");")
response.write("</script>")

It just goto Response.redirect "OS_addnew.asp"

The following is my complete code:

if strshipper<>"" and strorigin<>"" and strdest<>"" and
strinvoice_no<>"" and strpo_no<>"" then

'************************************************* *************************
' Insert Data
'************************************************* *************************
Set objConn1 = Server.CreateObject("ADODB.Connection")
objConn1.Open "driver={SQL
Server};server=10.129.2.20;database=FIH;uid=sa;pwd =sa"

strSQL = "INSERT Oversea
(os_no,forwarder,station,service_level,shipper,con signee,origin,dest,incoterms,invoice_no,po_no,good s_desc,bu,qty,plt,ctn,loose_ctn,gw_hawb,cw_hawb,"
&_

"gw_pl,cw_pl,shpt_value,booking_receiving_date,boo king_receiving_time,cargo_receiving_date,cargo_rec eiving_time,flight_no,flight_no1,flight_no2,flight _no3,"
&_

"etd_date,etd_time,etd_date1,etd_time1,etd_date2,e td_time2,etd_date3,etd_time3,eta_date,eta_time,eta _date1,eta_time1,eta_date2,eta_time2,eta_date3,eta _time3,"
&_

"hawb,mawb,mawb1,mawb2,mawb3,completed_date,comple ted_time,available_pu_date,available_pu_time,pod_d ate,pod_time,receiving_wh,event_report,inbound_no, outbound_no,remark,forwarder_pickup)"
&_
" values ('" & newdatecode &"','" & strforwarder &"','" &
strstation &"','" & strservice_level &"','" & strshipper &"','" &
strconsignee &"','" & strorigin &"','" & strdest &"', '" &
strincoterms &"','" & strinvoice_no &"','" & strpo_no &"','" &
strgoods_desc &"','" & strbu &"','" & strqty &"','" & strplt &"','" &
strctn &"','" & strloose_ctn &"','" & strgw_hawb &"','" & strcw_hawb
&"'," &_
"'" & strgw_pl &"','" & strcw_pl &"','" & strshpt_value &"'," &
strbooking_receiving_date &"," & strbooking_receiving_time &"," &
strcargo_receiving_date &"," & strcargo_receiving_time &",'" &
strflight_no &"','" & strflight_no1 &"','" & strflight_no2 &"','" &
strflight_no3 &"'," &_
"" & stretd_date &"," & stretd_time &"," & stretd_date1 &"," &
stretd_time1 &"," & stretd_date2 &"," & stretd_time2 &"," &
stretd_date3 &"," & stretd_time3 &"," & streta_date &"," & streta_time
&"," & streta_date1 &"," & streta_time1 &"," & streta_date2 &"," &
streta_time2 &"," & streta_date3 &"," & streta_time3 &"," &_
"'" & strhawb &"','" & strmawb &"','" & strmawb1 &"','" &
strmawb2 &"','" & strmawb3 &"'," & strcompleted_date &"," &
strcompleted_time &","& stravailable_pu_date &"," &
stravailable_pu_time &","& strPOD_date &"," & strPOD_time &",'" &
strreceiving_wh &"','" & strevent_report &"','" & strinbound_no &"','"
& stroutbound_no &"','" & strremark & "','" & strforwarder_pickup &
"')"

objConn1.Execute strSQL

Response.Write("<script>")
Response.Write("alert (""Hello"");")
response.write("</script>")

Response.redirect "OS_addnew.asp"

end if

Please Help. Thanks.
Jun 27 '08 #1
4 2226
hon123456 wrote on 26 mei 2008 in microsoft.public.inetserver.asp.general:
Dear all,

I have the following code which add a new record to
database, after the record has been added. I want to prompt a message
"Hello". But the following script does not promt.
Response.Write("<script>")
Response.Write("alert (""Hello"");")
response.write("</script>")

It just goto Response.redirect "OS_addnew.asp"
Response.redirect adds a header directive, so no page content is ever
transmitted to the client, so no clientside code can be executed.

Try:

%>
<script type='text/javascript'>
alert ('Hello');
location.href = 'OS_addnew.asp';
</script>
<%

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 27 '08 #2
Javascript is Client Side code and therefore is executed AFTER the
server side code, by which time you have "response.redirect" ed away!
So the javascript alert box never gets executed.

I would either:

1) Use a confirm box in javascript rather than alert and then the
confirm can handle the redirect
2) Display the confirmation response in the browser and have a
javascript timer which will redirect the user after 5 seconds for
example.
Jun 27 '08 #3
On 5$B7n(B26$BF|(B, $B2<8a(B4$B;~(B27$BJ,(B, daddywhite <davidwhitef...@hotmail.comwrote:
Javascript is Client Side code and therefore is executed AFTER the
server side code, by which time you have "response.redirect" ed away!
So the javascript alert box never gets executed.

I would either:

1) Use a confirm box in javascript rather than alert and then the
confirm can handle the redirect
2) Display the confirmation response in the browser and have a
javascript timer which will redirect the user after 5 seconds for
example.
Thanks all,

But I am rather new to javascript , can u post some code
of solution

Thanks.
Jun 27 '08 #4
hon123456 wrote:
But I am rather new to javascript , can u post some code
of solution
No Javascript is needed:

<h1>Hello</h1>
<a href="OS_addnew.asp">Click here to continue</a>
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: rathnesh | last post by:
when using a web application which includes taking an asp page then going to another asp page and coming back to first page ...some times connection to iis gets terminated and page canot be...
7
by: Robert Mark Bram | last post by:
Hi All! In the code below, I am reading in an xhtml document and attempting to use selectNodes to find a <p id="rmb"> node.. But the result is: 2 - */* 0 - */p Can anyone suggest what I...
8
by: wASP | last post by:
Hi, I'm having a problem referencing the elements within an object after a method of that object (a member function) has been activated with an onsubmit handler: - - - - - - - - ...
2
by: balakrishnan.dinesh | last post by:
Hi frends & collins, The code below is the one Im using now for xmlhttp request in IE as well as Netscape browser.I have put this code in a server,if i want to retrive the data from the same...
6
mmarif4u
by: mmarif4u | last post by:
Hi everyone. i make a page that a user input thier icnumber with confirm ic number, it saves the data to mysql db with current date and a random access code generated automatically, NOW i have...
3
by: xcampanoli | last post by:
When I uncomment either of the http urls below instead of the local file, I always get a readyStatus of zero, and I never get past trace 2 alert. When I use the local file I get readyStatus 1 and...
4
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my...
0
by: nickyeng | last post by:
I have this following code which it makes me cannot send sms in my j2me application. import com.sun.midp.ssl.CryptoException; public class Encrypter { public static String...
3
by: pinko1204 | last post by:
My Update function cannot successful update to sql table even don't have any error. Please help to check .....thx PHP1 <?php require_once 'header.php'; ?> <style type="text/css"> <!--
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.