I set up the connection and opened the recordset, but when I ran it this is what I got:
Error Type:
ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed or invalid in this context.
/resultspage.asp, line 12
Here is my code; what am I doing wrong??
<%
DIM objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=SQLOLEDB Data source = 192.168.114.144 Database =ContactInfo; user id = sa; password = eleven"
%>
<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "CustInfo", objConn, , adLockOptimistic, adCmdTable
objRS.AddNew
objRS("Email") = Request.Form("Email")
objRS("Name") = Request.Form("Name")
objRS("Comments") = Request.Form("Comments")
objRS.Update
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>
<p>
<%
Dim strName
strName = Request.Form("Name")
Response.Write strName
%>,</p>
Thanks, Prog76
Error Type:
ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed or invalid in this context.
/resultspage.asp, line 12
Here is my code; what am I doing wrong??
<%
DIM objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=SQLOLEDB Data source = 192.168.114.144 Database =ContactInfo; user id = sa; password = eleven"
%>
<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "CustInfo", objConn, , adLockOptimistic, adCmdTable
objRS.AddNew
objRS("Email") = Request.Form("Email")
objRS("Name") = Request.Form("Name")
objRS("Comments") = Request.Form("Comments")
objRS.Update
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>
<p>
<%
Dim strName
strName = Request.Form("Name")
Response.Write strName
%>,</p>
Thanks, Prog76