I have just recently started to experiment with ASP.
I find it to be quite flexible and reusable.
However I cannot get to connect to a database
i keep getting this error
Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
Code:
<%@LANGUAGE="VBSCRIPT" %>
<html>
<head>
<title>PHONE BOOK</title>
</head>
<body bgcolor=black>
<center>
<h2><font color="yellow">PHONE BOOK</font></h2>
<font face="MS Gothic" >
<FORM NAME="PhoneBook" METHOD="GET" ACTION="phone.asp">
<p>
<table border="1" bordercolor="green">
<tr>
<td><font face="MS Gothic" color="yellow"><b>First Name:</b> </td>
<td><INPUT TYPE="TEXT" NAME="fname" VALUE="" SIZE="20" MAXLENGTH="25"></td>
</tr>
<tr>
<td><font face="MS Gothic" color="yellow"><b>Last Name:</b> </td>
<td><INPUT TYPE="TEXT" NAME="lname" VALUE="" SIZE="20" MAXLENGTH="25"></td>
</tr><tr>
<td><font face="MS Gothic" color="yellow"><b>Phone #:</b></td>
<td><INPUT TYPE="TEXT" NAME="phone" VALUE="" SIZE="11" MAXLENGTH="12"></td>
</tr>
<tr>
<td><font face="MS Gothic" color="yellow"><b>Birthday:</b></td>
<td><INPUT TYPE="TEXT" NAME="dob" VALUE="" SIZE="11" MAXLENGTH="10"></td>
</tr>
<tr>
<td><font face="MS Gothic" color="yellow"><b>E-mail :</b></td>
<td><INPUT TYPE="TEXT" NAME="email" VALUE="" SIZE="20" MAXLENGTH="25"></td>
</tr>
<tr>
<td><input type="CHECKBOX" name= "sex2" value="Male"> <font color="yellow"><b>Male</b><BR> </td><td><INPUT TYPE="CHECKBOX" NAME= "sex" VALUE="Female">
<font color="yellow"><b>Female </b><BR></td>
</tr>
</table>
<p>
<INPUT TYPE="SUBMIT" VALUE="Submit">
<INPUT TYPE="RESET" VALUE="Clear ">
</p>
</form>
</font>
</center>
<br>
<%
dim strfname, strlname, strphone, stremail, strdob, strsex
strfname =Server.HTMLEncode( Request.QueryString("fname"))
strlname =Server.HTMLEncode( Request.QueryString("lname"))
strphone =Server.HTMLEncode( Request.QueryString("phone"))
stremail =Server.HTMLEncode( Request.QueryString("email"))
strdob =Server.HTMLEncode( Request.QueryString("dob"))
strsex =Server.HTMLEncode( Request.QueryString("sex"))
DIM objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "http://localhost/phonebook.mdb", objConn, , adLockOptimistic, adCmdTable
objRS.AddNew
objRS("fname") = Request.Form("fname")
objRS("lname") = Request.Form("lname")
objRS("phone") = Request.Form("phone")
objRS("email") = Request.Form("email")
objRS("dob") = Request.Form("dob")
objRS("sex") = Request.Form("sex")
objRS.Update
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
'Display what was entered.
If ("" = strfname) OR ("" = strphone) Then
Response.Write "<font color=yellow><P>(Please Input relevant feilds)</P>"
Else
Response.Write "<font color=yellow>First Name: <b>" & strfname & "</b><br>"
Response.Write "<font color=yellow>Last Name: <b>" & strlname & "</b><br>"
Response.Write " <font color=yellow>Phone # <b>:" & strphone & "</b><br> "
Response.Write "<font color=yellow>Email:<b> " & stremail & "</b><br> "
Response.Write "<font color=yellow> Dob:<b> " & strdob & "</b><br>"
Response.Write "<font color=yellow> Sex: <b>" & strsex & "</b><br></P>"
End If
%>
</body>
</html>