" End If %>

<% If Not Request.QueryString("Message1") = "True" Then 'No information has been input yet, so provide the form. %> Please fill up your detail below:

Full Name :
Date of birth: Month Day Year
Current Address.
Gender : Male Female
Graduation Year
Phone :
Qualification :
Current Job
Your Message:

<% Else 'The HIDDEN button above sets the Message variable to True. 'We know now that form data has been entered. 'Get the data from the form. We will be inserting it into the database. 'Access doesn't like some characters, such as single-quotes, so encode the ' data using the HTMLEncode method of the ASP Server object. dim strTB1, strTB2, strTB3, strTB4, strTB5, strTB6, strTB7, strTB8, strTB9, strTB10, strTB11, strTB12, strTB13, strMB14, strCommand strTB1 = Server.HTMLEncode(Request.QueryString("graduationyear")) strTB2 = Server.HTMLEncode(Request.QueryString("gender")) strTB3 = Server.HTMLEncode(Request.QueryString("email")) strTB4 = Server.HTMLEncode(Request.QueryString("fullname")) strTB5 = Server.HTMLEncode(Request.QueryString("address1")) strTB6 = Server.HTMLEncode(Request.QueryString("currentjob")) strTB7 = Server.HTMLEncode(Request.QueryString("qualification")) strTB8 = Server.HTMLEncode(Request.QueryString("phone")) strTB9 = Server.HTMLEncode(Request.QueryString("country")) strTB10 = Server.HTMLEncode(Request.QueryString("address2")) strTB11 = Server.HTMLEncode(Request.QueryString("birth_date")) strTB12 = Server.HTMLEncode(Request.QueryString("birth_month")) strTB13 = Server.HTMLEncode(Request.QueryString("birth_year")) strMB14 = Server.HTMLEncode(Request.QueryString("message")) 'This is a connection string. ADO uses it to connect to a database through the Access driver. 'It needs the provider name of the Access driver and the name of the Access database. 'Connection strings are slightly different, depending on the provider being used, ' but they all use semicolons to separate variables. 'If this line causes and error, search in your registry for ' Microsoft.JET to see if 4.0 is your version. strProvider = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:\Inetpub\vhosts\\httpdocs\app_data\student.mdb;" 'strProvider = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:\InetPub\Wwwroot\student.mdb;" 'This creates an instance of an ADO Connection object. 'There are 4 other ADO objects available to you, each with different methods and 'properties that allow you to do almost anything with database data. Set objConn = server.createobject("ADODB.Connection") 'The Open method of the Connection object uses the connection string to ' create a connection to the database. objConn.Open strProvider 'Define the query. 'There are many types of queries, allowing you to add, remove, or get data. 'This query will add your data into the database, using the INSERT INTO key words. 'Here, GuestBook is the name of the table. 'You need single-quotes around strings here. strCommand = "INSERT INTO exstudent (graduationyear,gender,email,fullname,address1,currentjob,qualification,phone,country,address2,birth_date,birth_month,birth_year,message) VALUES ('" & strTB1 & "','" & strTB2 & "','" & strTB3 & "','" & strTB4 & "','" & strTB5 & "','" & strTB6 & "','" & strTB7 & "','" & strTB8 & "','" & strTB9 & "','" & strTB10 & "','" & strTB11 & "','" & strTB12 & "','" & strTB13 & "','" & strMB14 strCommand = strCommand & "')" 'Execute the query to add the data to the database. objConn.Execute strCommand Response.Write"
Thank You! Your data has been added.

Lower TCV Computer Lab.