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!

Hi, i do not what the error was. Ca

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi, i do not what the error was. Can you advise me on what is the error .Thanks

Below is the code that i have i entered:


<%


if (Request(&quot;submit&quot;) <> &quot;&quot;) Then

Dim DataConn ' ADO connection object
Dim sql_update, ConnString, objRs
Dim myName, myUserID, myPwd, myDept, myYr, myEmail, SQL

myName = Request.Form (&quot;text1&quot;)
myUserID = Request.Form (&quot;text2&quot;)
myPwd = Request.Form (&quot;password1&quot;)
myDept = Request.Form (&quot;select1&quot;)
myYr = Request.Form (&quot;seelct10&quot;)
myEmail= Request.Form (&quot;text3&quot;)



Set DataConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
ConnString=&quot;driver={sql server};server=CON7; database=user;DSN=localserver;PWD=;UID=sa;&quot;
DataConn.Open ConnString
'Set objRs=server.CreateObject (&quot;ADODB.Recordset&quot;)


SQL=&quot;UPDATE TABLE info &quot; & _
&quot;SET NameID='&quot; & myNameID & &quot;', &quot; & _
&quot;UserID='&quot; & myUserID & &quot;', &quot; & _
&quot;password='&quot; & myPwd & &quot;', &quot; & _
&quot;yearinfo='&quot; & myYr & &quot;', &quot; & _
&quot;email='&quot; & myEmail & &quot;', &quot; & _
&quot;WHERE department='&quot; & myDept & &quot;'&quot;

DataConn.Execute (SQL)

Response.Redirect (&quot;Omega.asp&quot;)
else%>
<script>
window.alert (&quot;Records cannot be updated&quot;)
</script>
<%end if

Line 55 DataConn.Close
Set DataConn = Nothing

%>



Microsoft VBScript runtime error '800a01a8'

Object required: ''

/update2.asp, line 55

 
This is your code with the IF true logic removed. If Request(&quot;submit&quot;) = &quot;&quot; then you still execute Else and the Data.Conn Close after the End If. Put the DataConn.Close just before the Else.
<%
if (Request(&quot;submit&quot;) <> &quot;&quot;) Then
.......
else%>
<script>
window.alert (&quot;Records cannot be updated&quot;)
</script>

<%end if
DataConn.Close
Compare Code (Text)
Generate Sort in VB or VBScript
 
May i know how to update 2 tables in 1 database.



Thank You.
LOL
 
all you need to do is define and execute 2 separate sql statements, one for each table:

SQL=&quot;UPDATE TABLE1 info &quot; & _
&quot;SET NameID='&quot; & myNameID & &quot;', &quot; & _
&quot;UserID='&quot; & myUserID & &quot;', &quot; & _
&quot;password='&quot; & myPwd & &quot;', &quot; & _
&quot;yearinfo='&quot; & myYr & &quot;', &quot; & _
&quot;email='&quot; & myEmail & &quot;', &quot; & _
&quot;WHERE department='&quot; & myDept & &quot;'&quot;

DataConn.Execute (SQL)

SQL=&quot;UPDATE TABLE2 info &quot; & _
&quot;SET NameID='&quot; & myNameID & &quot;', &quot; & _
&quot;UserID='&quot; & myUserID & &quot;', &quot; & _
&quot;password='&quot; & myPwd & &quot;', &quot; & _
&quot;yearinfo='&quot; & myYr & &quot;', &quot; & _
&quot;email='&quot; & myEmail & &quot;', &quot; & _
&quot;WHERE department='&quot; & myDept & &quot;'&quot;

DataConn.Execute (SQL)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top