|
for inserting records
<!--#include file="easyasp_dbconn.asp"--> <!--#include file="easyasp_adovbs.asp"--> <html><head><title>New record</title><link rel="stylesheet" href="Easyasp.css" type="text/css" /></head><body leftmargin="10" rightmargin="10" bottommargin="10" topmargin="10" bgcolor="#FFFFFF"><form name="AutoForm" method="POST" enctype="" action="Students_DBInsert.asp"> <%
%>
<input type=hidden value="<%=Request.QueryString("easy_Page")%>" name="easy_Page"> <input type=hidden value="<%=Request.QueryString("easy_Buscar")%>" name="easy_Buscar"> <input type=hidden value="<%=Request.QueryString("easy_orderby")%>" name="easy_orderby"> <input type=hidden value="<%=Request.QueryString("easy_orderby_order")%>" name="easy_orderby_order"> <span class="Titulo">New record</span><hr width="100%" size="1" color="#4490D1" /><table cellpadding="4" cellspacing="0" border="0" align="center"><tr><td class="Normal" align="right" valign="top">First Name</td><td class="Normal" valign="top"><input class="Plano" name="First Name" type="text" maxlength="" /></td></tr><tr><td class="Normal" align="right" valign="top">Last Name</td><td class="Normal" valign="top"><input class="Plano" name="Last Name" type="text" maxlength="" /></td></tr><tr><td class="Normal" align="right" valign="top">Student Number</td><td class="Normal" valign="top"><input class="Plano" name="Student Number" type="text" maxlength="" /></td></tr><tr><td class="Normal" align="right" valign="top">Athens Username</td><td class="Normal" valign="top"><input class="Plano" name="Athens Username" type="text" maxlength="" /></td></tr><tr><td valign="top" colspan="2" align="center"><input class="Boton" type="submit" value=" Insert " /></td></tr></table></form><di v class="Normal" align="center"><a class="Normal" href="javascript:history.back()">Back</a></div&g t;<br /><br /> <% objConn.Close set objConn=nothing %> <br/> </body></html>
Once this is run I get the error message
if you can log into the site then please do so at http://khan2/tvu/athens/students_insertform.asp - http://khan2/tvu/athens/students_insertform.asp
this is the code that it looks at when the submit button is clicked
<!--#include file="easyasp_dbconn.asp"--> <!--#include file="easyasp_adovbs.asp"-->
<% on error resume next Errores=""
easy_Page=Request("easy_Page") easy_Buscar=Request("easy_Buscar") easy_orderby=Request("easy_orderby") easy_orderby_order=Request("easy_orderby_order")
First Name=Request("First Name")
Last Name=Request("Last Name")
Student Number=Request("Student Number")
Athens Username=Request("Athens Username")
if Errores="" then
set Cmd=server.createobject("adodb.command") Cmd.activeconnection=objConn Cmd.commandtype=adCmdText Cmd.commandtext="insert into Students(First Name,Last Name,Student Number,Athens Username) values(?,?,?,?)"
Cmd.Parameters.Append Cmd.CreateParameter("?",adVarWChar, adParamInput, 50,"First Name") Cmd.Parameters.Append Cmd.CreateParameter("?",adVarWChar, adParamInput, 50,"Last Name") Cmd.Parameters.Append Cmd.CreateParameter("?",adInteger, adParamInput, 8,"Student Number") Cmd.Parameters.Append Cmd.CreateParameter("?",adVarWChar, adParamInput, 50,"Athens Username")
Cmd.Execute set cmd=nothing if err.number<>0 then Errores=Errores&Err.Description&"<br>" end if
objConn.Close set objConn=nothing if Errores="" then Response.Redirect("Students_List.asp?easy_Page=" & easy_Page & "&easy_Buscar=" & easy_Buscar & "&easy_orderby=" & easy_orderby & "&easy_orderby_order=" & easy_orderby_order) end if
end if if Errores<>"" then%> <html><head><title>Error</title> <link rel="stylesheet" href="Easyasp.css" type="text/css" /> </head> <body leftmargin="10" rightmargin="10" bottommargin="10" topmargin="10" bgcolor="#FFFFFF"> <%Response.Write("<div class=""Normal"" align=""center""><br><strong>The following errors were founded while inserting the record</strong><br><br>") Response.Write("<span class=""Error"">") Response.Write(Errores) Response.Write("</span>") Response.Write("<br><br><a class=""Normal"" href=""javascript:history.back()"">click here to go back</a></div><br>") %> <%objConn.Close set objConn=nothing end if %>
Thanks..
|