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

Not sure of the following problem!!!

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi everyone
I had a problem with adding data into a database. The following is the code. And i will like to know what cause the problem. The problem says that :

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/recordset.asp, line 21

I really can't figure out what this meant and is the code correct.

Thanks a lot

<%
Dim DataConn, RsPerson, SQL, sqlstr

Set DataConn = Server.CreateObject(&quot;ADODB.Connection&quot;)'change your server name to replace omega and name of database to replace 2K04
DataConn.ConnectionString=&quot;driver={sql server};server=CON7; database=user;DSN=localserver;PWD=sa;UID=sa;&quot;

;line 21 Conn.Open DataConn

sqlstr = &quot;INSERT INTO info(Student_Name, UserID, Password, Department, Year, e-mail) Values('&quot; & request(&quot;text1&quot;) & &quot;', '&quot; & request(&quot;text2&quot;) & &quot;', '&quot; & request(&quot;password1&quot;) & &quot;', '&quot; & request(&quot;select2&quot;) & &quot;', '&quot; & request(&quot;radio1&quot;)& &quot;', '&quot; & request(&quot;text4&quot;) & &quot;')&quot;

Conn.close
Set Conn = nothing
%>

<%
if (Request(&quot;submit&quot;) <> &quot;&quot;) then
Set RsPerson = DataConn.Execute(sqlstr)
if not RsPerson.eof then
Response.Redirect(&quot;else%>
<script>
window.alert(&quot;Invalid UserID or Password&quot;);
</script>
<%end if%>
<%end if
%>
 


<%
Dim DataConn ' ADO connection object
RsPerson, SQL, sqlstr

Set DataConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
DataConn.ConnectionString=&quot;driver={sql server};server=CON7; database=user;DSN=localserver;PWD=sa;UID=sa;&quot;
DataConn.Open
sqlstr = &quot;INSERT INTO info(Student_Name, UserID, Password, Department, Year, e-mail) Values('&quot; & request(&quot;text1&quot;) & &quot;', '&quot; & request(&quot;text2&quot;) & &quot;', '&quot; & request(&quot;password1&quot;) & &quot;', '&quot; & request(&quot;select2&quot;) & &quot;', '&quot; & request(&quot;radio1&quot;)& &quot;', '&quot; & request(&quot;text4&quot;) & &quot;')&quot;

%>

<%
if (Request(&quot;submit&quot;) <> &quot;&quot;) then
Set RsPerson = DataConn.Execute(sqlstr)
DataConn.close
Set DataConn = Nothing
if not RsPerson.eof then
Response.Redirect(&quot;else%>
<script>
window.alert(&quot;Invalid UserID or Password&quot;);
</script>
<%end if%>
<%end if
%>
 
SET RsPerson = Server.Creatobject(&quot;ADODB.Recordset&quot;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top