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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add new record asp vbscript

Status
Not open for further replies.

Halfjan

IS-IT--Management
Mar 11, 2012
1
GB
Essentially Im having this asp and ones like it being put up on a server tomorrow for demonstrations, but before they do I want to be sure itl work. this is on a .asp

<%@ Language="VBScript"%>
<%Option explicit%>
<%
Private sub Registration()
Dim Form
Set Form = Register.Form
Dim can as string
Dim Page as string
Dim cnxn as connection
Dim rsCandidatereg as recordset
Dim strcnxn as connectionstring
Dim strSQLCandidatereg as string
set Page = "Welcome.html"
Response.buffer = true

set can = Request.Form("1")

next

set cnxn = Server.CreateObject("ADODB.Connection")
set strcnxn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="
Server.MapPath("database.mdb")

cnxn.open strcnxn

Set rsCandidatereg = Server.CreateObject("ADODB.Recordset")
strSQLCandidatereg = "Candidatereg"

rsCandidatereg.ActiveConnection = cnxn
rsCandidatereg.Source = strSQLCandidatereg
rsCandidatereg.Open
rsCandidatereg.Addnew
rsCandidatereg.execute
(rsCandidatereg("field/column name") = can
rsCandidatereg.update)

then

strcnxn.Close
rsCandidatereg.Close
Set cnxn = Nothing
Set can = Nothing

Response.Redirect Page

end sub
%>
<%Registration()%>

 
Just switch on IIS on your test machine, and try it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top