Error: require object 'server' 
Author Message
 Error: require object 'server'

 Hello,

I want to send input to my access database using ASP.
After studie-ing many examples I came up with a script. But my problem is
that I can't use a form to get the data from the users. When I type  in my
script the next line:

<% tempID =358%>   it works. It changes the data in my Access db.

But when I use the input from a form:        tempID = TheForm.text1.Value

I get a msgbox saying: Error: require object 'server'

When I put the the next line in my script:    msgbox "temporary iD " &
tempID

returns   temporary iD   and the number I typed in the form. AFAIK this
means that tempID has got the value wich was typed into the form.
But why do I get that Error: require object 'server' ? ?

TIA ,  Erik     eruys$fnl.nl



Tue, 23 Apr 2002 03:00:00 GMT  
 Error: require object 'server'
It looks like you're mixing server-side and client-side code.  Post your
full code.


Tue, 23 Apr 2002 03:00:00 GMT  
 Error: require object 'server'



Quote:
> It looks like you're mixing server-side and client-side code.  Post your
> full code.

<HTML>
<HEAD>

<SCRIPT LANGUAGE = VBScript>
<!--
Sub Button1_OnClick
  Dim DataConn
  Dim CmdUpdateRecord
  Dim MYSQL
  Dim TheForm
  Dim uitgave_naam
  Dim tmpID
  Set TheForm = Document.invoerForm
  If IsNumeric(TheForm.Text1.Value) Then
  msgbox "test" & TheForm.Text1.Value
  tmpID = TheForm.Text1.Value
  uitgave_naam = TheForm.Text2.Value
  msgbox "test" & tmpID

  Set DataConn = Server.CreateObject("ADODB.Connection")
  Set CmdUpdateRecord = Server.CreateObject("ADODB.Recordset")

  DataConn.Open "DSN=dsn-name","",""

  MYSQL="SELECT testscantabel.* FROM testscantabel WHERE(tmpID="& tmpID &")"

  CmdUpdateRecord.Open MYSQL,DataConn,1,3
  CmdUpdateRecord.Fields("uitgave_naam") = uitgave_naam
  CmdUpdateRecord.Update

  ' closing objects and setting them to nothing
  ' not neccesary but a good habit

  CmdUpdateRecord.Close
  Set CmdUpdateRecord = Nothing
  DataConn.Close
  Set DataConn = Nothing

 Else
    MsgBox "Please enter a numeric value."
  End If
End Sub
-->
</SCRIPT>

</HEAD>

<BODY>

<H3>Simple Validation</H3><HR>
<FORM NAME="invoerForm" ACTION="database.asp" METHOD="get">
voer het identieke nummer in:
<INPUT NAME="Text1" TYPE="LONG" SIZE="3">
<INPUT NAME="Text2" TYPE="TEXT" SIZE="50">
<INPUT NAME="Button1" TYPE="BUTTON" VALUE="run query">
</FORM>

</BODY>

</HTML>

Thank you



Tue, 23 Apr 2002 03:00:00 GMT  
 Error: require object 'server'
This code is running on your client and there is no Server object on the
client, it's on the server and is provided by ASP.

Look at some samples for accessing data using ASP and samples on ASP as
well, there are loads around; look on microsoft's site.  Or get a book on
ASP as what you're doing is a fundamental mistake, that of mixing server and
client code.



Tue, 23 Apr 2002 03:00:00 GMT  
 Error: require object 'server'



Quote:
> This code is running on your client and there is no Server object on the
> client, it's on the server and is provided by ASP.

> Look at some samples for accessing data using ASP and samples on ASP as
> well, there are loads around; look on microsoft's site.  Or get a book on
> ASP as what you're doing is a fundamental mistake, that of mixing server
and
> client code.

I save the script on the server. In a map wich is situated in
inetpub\wwwroot\
The server runs iis4.0, and the system DSN is valid and works correct.

I have made other ASP wich uses a ActiveX object. They all worked. But my
problem is that it doesn't run on MacOS. Therefor I am using(and learning)
VBScript. I have searched the web for more than a week. But I can't find a
example wich uses an input form, sends it to Access and does not use a
clsid.  I may not understand what I am doeing wrong but I am trying.
I want to thank you for your reply, now I know that it has got something to
do with client/server code.



Tue, 23 Apr 2002 03:00:00 GMT  
 Error: require object 'server'
You understand the data access side, it's just the ASP side.  If you have a
text box and want to store the value in a database you need two pages

on page1.htm (or page1.asp)

<form action="page2.asp" method=post>
Enter your text: <input type=text name=txtText>
<input type=submit value="Save">
</form>

on page2.asp

<%

sText = request("txtText")    ' get the data from the submitted form)

' now you can save this however you want...
CmdUpdateRecord.Open MYSQL,DataConn,1,3
CmdUpdateRecord.Fields("uitgave_naam") = sText
CmdUpdateRecord.Update



Tue, 23 Apr 2002 03:00:00 GMT  
 Error: require object 'server'

Adrian Forbes , Thank you very, very much for your help.
I have made two pages and I can update my databasase by using a browser.

thanks,

Erik Ruijs



Fri, 26 Apr 2002 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Object required: 'server'

2. runtime error 800a01a8, Object Required: 'Application(...)'

3. Error: object required: 'WScript'

4. Run-time error '424': Object required

5. Run-Time error '424': object Required

6. error - Object required 'DoCmd'

7. Run-time error '424' Object Require

8. Run-time error '424' Object Required

9. Run-time error '424' Object required

10. Run-time error '424' Object required

11. Help: 'Object Required' - error 42

12. runtime error object required 'id'

 

 
Powered by phpBB® Forum Software