DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Server.CreateObject Problem

  1. #1
    Mike Guest

    Server.CreateObject Problem


    I am relatively new at Web app development. I am trying to create a
    database connection using ASP and VBScript and keep getting an error
    with the Server.CreateObject("ADODB.Connection"). It says that there is
    'Server' is not defined. Where is 'Server' defined and how do you use
    it or how do I define it to make this work?

    The code looks like this:

    dim oConn, sql, rs
    Set oConn = Server.CreateObject("ADODB.Connection") 'BLOWS UP HERE
    oConn.Open ("driver={Microsoft Access Driver (*.mdb)}; dbq=p:\\dtspo-project\\drdatabase1.mdb")
    sql = "select * from <table name>"
    rs = oConn.execute( sql )

    What am I doing wrong and how do I go about fixing it?

    Thanks in advance.

    Mike

  2. #2
    vishal Guest

    Re: Server.CreateObject Problem


    "Mike" <mskane@tasc.com> wrote:
    >
    >I am relatively new at Web app development. I am trying to create a
    >database connection using ASP and VBScript and keep getting an error
    >with the Server.CreateObject("ADODB.Connection"). It says that there is
    >'Server' is not defined. Where is 'Server' defined and how do you use
    >it or how do I define it to make this work?

    Hi,
    Its not ur code problem.
    if it saysL Server is undefined that means that asp loaded on ur machine
    is not having proper required DLL's on ur machiine
    u probably wanna re;load asp on ur machine
    hope it will solve it.
    regards,

    vishal



    >
    >The code looks like this:
    >
    >dim oConn, sql, rs
    >Set oConn = Server.CreateObject("ADODB.Connection") 'BLOWS UP HERE
    >oConn.Open ("driver={Microsoft Access Driver (*.mdb)}; dbq=p:\\dtspo-project\\drdatabase1.mdb")
    >sql = "select * from <table name>"
    >rs = oConn.execute( sql )
    >
    >What am I doing wrong and how do I go about fixing it?
    >
    >Thanks in advance.
    >
    >Mike



  3. #3
    tmc Guest

    Re: Server.CreateObject Problem


    "Mike" <mskane@tasc.com> wrote:
    >
    >I am relatively new at Web app development. I am trying to create a
    >database connection using ASP and VBScript and keep getting an error
    >with the Server.CreateObject("ADODB.Connection"). It says that there is
    >'Server' is not defined. Where is 'Server' defined and how do you use
    >it or how do I define it to make this work?
    >
    >The code looks like this:
    >
    >dim oConn, sql, rs
    >Set oConn = Server.CreateObject("ADODB.Connection") 'BLOWS UP HERE
    >oConn.Open ("driver={Microsoft Access Driver (*.mdb)}; dbq=p:\\dtspo-project\\drdatabase1.mdb")
    >sql = "select * from <table name>"
    >rs = oConn.execute( sql )
    >
    >What am I doing wrong and how do I go about fixing it?
    >
    >Thanks in advance.
    >
    >Mike



  4. #4
    Robert Goble Guest

    Re: Server.CreateObject Problem


    "tmc" <tmccuan@hotmail.com> wrote:
    >
    >"Mike" <mskane@tasc.com> wrote:
    >>
    >>I am relatively new at Web app development. I am trying to create a
    >>database connection using ASP and VBScript and keep getting an error
    >>with the Server.CreateObject("ADODB.Connection"). It says that there is
    >>'Server' is not defined. Where is 'Server' defined and how do you use


    >>it or how do I define it to make this work?
    >>
    >>The code looks like this:
    >>
    >>dim oConn, sql, rs
    >>Set oConn = Server.CreateObject("ADODB.Connection") 'BLOWS UP HERE
    >>oConn.Open ("driver={Microsoft Access Driver (*.mdb)}; dbq=p:\\dtspo-project\\drdatabase1.mdb")
    >>sql = "select * from <table name>"
    >>rs = oConn.execute( sql )
    >>
    >>What am I doing wrong and how do I go about fixing it?
    >>
    >>Thanks in advance.
    >>
    >>Mike

    >

    Take out the Server. prefix
    Set oConn = CreateObject("ADODB.Connection") Works for me.

  5. #5
    Mathan Guest

    Re: Server.CreateObject Problem


    It depends on what server you are using,
    NT server is recommended for all server applications.
    Still,you found an error reinstall your server once again.

    try with small letters,
    regards,
    Mathan

    "Mike" <mskane@tasc.com> wrote:
    >
    >I am relatively new at Web app development. I am trying to create a
    >database connection using ASP and VBScript and keep getting an error
    >with the Server.CreateObject("ADODB.Connection"). It says that there is
    >'Server' is not defined. Where is 'Server' defined and how do you use
    >it or how do I define it to make this work?
    >
    >The code looks like this:
    >
    >dim oConn, sql, rs
    >Set oConn = Server.CreateObject("ADODB.Connection") 'BLOWS UP HERE
    >oConn.Open ("driver={Microsoft Access Driver (*.mdb)}; dbq=p:\\dtspo-project\\drdatabase1.mdb")
    >sql = "select * from <table name>"
    >rs = oConn.execute( sql )
    >
    >What am I doing wrong and how do I go about fixing it?
    >
    >Thanks in advance.
    >
    >Mike



  6. #6
    Ken Guest

    Re: Server.CreateObject Problem


    Ken's response

    check out your path
    dbq=p:\\dtspo-project\\drdatabase1.mdb

    dbq=p:\\dtspo-project\drdatabase1.mdb

    "Mike" <mskane@tasc.com> wrote:
    >
    >I am relatively new at Web app development. I am trying to create a
    >database connection using ASP and VBScript and keep getting an error
    >with the Server.CreateObject("ADODB.Connection"). It says that there is
    >'Server' is not defined. Where is 'Server' defined and how do you use
    >it or how do I define it to make this work?
    >
    >The code looks like this:
    >
    >dim oConn, sql, rs
    >Set oConn = Server.CreateObject("ADODB.Connection") 'BLOWS UP HERE
    >oConn.Open ("driver={Microsoft Access Driver (*.mdb)}; dbq=p:\\dtspo-project\\drdatabase1.mdb")
    >sql = "select * from <table name>"
    >rs = oConn.execute( sql )
    >
    >What am I doing wrong and how do I go about fixing it?
    >
    >Thanks in advance.
    >
    >Mike



  7. #7
    ComeOn Guest

    Re: Server.CreateObject Problem


    First of all it depends on the web server you are using. If you are using
    Personal Web Server or IIS then make sure your file ends in an .asp extension.
    If it does then you must enclose your code in <% code here %> tags.

    With IIS you can map your file extensions to a dll used to interpret it.
    A file ending in .asp is mapped to the asp.dll which interprets your code.

    "Mike" <mskane@tasc.com> wrote:
    >
    >I am relatively new at Web app development. I am trying to create a
    >database connection using ASP and VBScript and keep getting an error
    >with the Server.CreateObject("ADODB.Connection"). It says that there is
    >'Server' is not defined. Where is 'Server' defined and how do you use
    >it or how do I define it to make this work?
    >
    >The code looks like this:
    >
    >dim oConn, sql, rs
    >Set oConn = Server.CreateObject("ADODB.Connection") 'BLOWS UP HERE
    >oConn.Open ("driver={Microsoft Access Driver (*.mdb)}; dbq=p:\\dtspo-project\\drdatabase1.mdb")
    >sql = "select * from <table name>"
    >rs = oConn.execute( sql )
    >
    >What am I doing wrong and how do I go about fixing it?
    >
    >Thanks in advance.
    >
    >Mike



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center