Hi,
Its very easy. The code which you have written is ok, and you
have learn more on event driven programming and separating code from
content.
Just avoid the "Document.Add.Submit();" statement in
JavaScript. Becoz of this, it inserts twice. Also, you put the ASP
script to insert a function in a function.
Kishore PB.
--- In [EMAIL PROTECTED], "Seetha"
<[EMAIL PROTECTED]> wrote:
> Hai all!
>
> I am using the following code for adding a record into the
database.
>
> I am giving only one insert command in my coding.
>
> But it is storing two times into the database. I don't know the
> reason for this.
>
> My friends also facing the same problem.
>
> If anybody knows the reason, plz help me correct it. It is very
> urgent...........
>
> Thanx in advance
>
> Seetha
>
>
>
> <html>
>
> <head>
> <SCRIPT LANGUAGE=javascript>
> function gopage1()
> {
> document.add.method="post"
> document.add.action="userteianentry.asp?FOC=4"
> document.add.submit()
> }
> </SCRIPT>
> </head>
> <body>
> <form name=add>
> <!--#include file="Conn.asp"-->
> <%
>
> uc=68
>
> set RS=Server.CreateObject("ADODB.Recordset")
> sql="SELECT max(teianno) FROM teian WHERE unitcode=" & uc & ""
> rs.Open sql,conn
>
> n=rs(0) +1
>
>
> sql2="insert into teian values(" & uc & "," & n & ")"
> conn.execute sql2
> %>
> <br>
> <br>
> <br><br><br><br><br><br><br><br>
>
>
> <center><font face="Trebuchet MS" color=navy><%=oldn%> - <%=n-1%>
is
> Updated</font><br>
> <input type="image" src="back.jpg" name="image1" onclick="gopage1
> ()"></center>
>
> <%conn.close
> %>
>
> </form>
> </body>
> </html>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/