1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Problem with ASP web site...

Discussion in 'Software Development' started by Ophidian, Dec 16, 2001.

Thread Status:
Not open for further replies.
Advertisement
  1. Ophidian

    Ophidian Thread Starter

    Joined:
    Jul 14, 2001
    Messages:
    119
    Ok well a friend of mine is working on making a site and he's doing it in ASP. Now, I'm not really fluent in web design so I'm kinda stuck as much as he is. Maybe someone here can provide some help. It's apparently not recognizing the database for some reason which we can't figure out. Here is the code for the portion of the site that isn't working:

    <%@ Language="JavaScript" %>
    <!-- #include file="adojavas.inc" -->


    <html>
    <head></head>

    <body>


    <br>
    <hr width=700>

    <center><h1> Online Catalog</h1></center>

    <hr width=700>


    <br>
    <br/>

    <%
    var strConn="dsn=project2;uid=wchaudry;pwd=75006363;";
    var dbConnection= Server.CreateObject("ADODB.Connection");
    var objrecord = Server.CreateObject("ADODB.Recordset");

    dbConnection.Open(strConn);

    if(dbConnection.State == "adStateClosed")
    Response.Write(" Sorry, could not connect to the database");
    else
    {
    Response.Write("<table border=1 align=center> <tr><td>Author</td> <td>Title</td> <td>Publisher</td><td>In Stock</td> <td>Price</td></tr>");
    objrecord.Open("Books", dbConnection, adOpenForwardOnly, adLockReadOnly, adCmdTable);

    while(!objrecord.EOF)
    {
    var tauthor= objrecord("AuthorLastName") + "," + objrecord("AuthorFirstName")
    var ttitle = objrecord("Title");
    var tisbn = objrecord("ISBN");
    var tpublisher = objrecord("Publisher");
    var tprice = objrecord("Cost");
    var tinstock = objrecord("InStock");
    Response.Write("<tr> <td>" + tauthor+ " </td> <td> <a href= 'bookdetails.asp?id="+tisbn+ "'>" + ttitle + "</a></td> <td>" + tpublisher + "</td> <td>" + tinstock + "</td><td>" + tprice + "</td></tr>");
    objrecord.MoveNext();
    }
    }

    %>


    </body>

    </html>

    Copying and pasting it made it a lil messy there... sorry about that... if you need the rest of the code just let me know and I'll post it. Any help would be greatly appreciated. Thanks.
     
  2. Ophidian

    Ophidian Thread Starter

    Joined:
    Jul 14, 2001
    Messages:
    119
    Heh, alright I wasn't expecting it to actually implement the code there...

    //<%@ Language="JavaScript" %>
    //<!-- #include file="adojavas.inc" -->
    //
    //
    //<html>
    // <head></head>
    //
    // <body>
    //
    //
    // <br>
    // <hr width=700>
    //
    // <center><h1> Online Catalog</h1></center>
    //
    // <hr width=700>
    //
    //
    // <br>
    // <br/>
    //
    // <%
    // var strConn="dsn=project2;uid=wchaudry;pwd=75006363;";
    // var dbConnection= Server.CreateObject("ADODB.Connection");
    // var objrecord = Server.CreateObject("ADODB.Recordset");
    //
    // dbConnection.Open(strConn);
    //
    // if(dbConnection.State == "adStateClosed")
    // Response.Write(" Sorry, could not connect to the database");
    // else
    // {
    // Response.Write("<table border=1 align=center> <tr><td>Author</td> <td>Title</td> <td>Publisher</td><td>In Stock</td> <td>Price</td></tr>");
    // objrecord.Open("Books", dbConnection, adOpenForwardOnly, adLockReadOnly, adCmdTable);
    //
    // while(!objrecord.EOF)
    // {
    // var tauthor= objrecord("AuthorLastName") + "," + objrecord("AuthorFirstName")
    // var ttitle = objrecord("Title");
    // var tisbn = objrecord("ISBN");
    // var tpublisher = objrecord("Publisher");
    // var tprice = objrecord("Cost");
    // var tinstock = objrecord("InStock");
    // Response.Write("<tr> <td>" + tauthor+ " </td> <td> <a href= 'bookdetails.asp?id="+tisbn+ "'>" + ttitle + "</a></td> <td>" + tpublisher + "</td> <td>" + tinstock + "</td><td>" + tprice + "</td></tr>");
    // objrecord.MoveNext();
    // }
    // }
    //
    // %>
    //
    //
    // </body>
    //
    //</html>
    Code:
    Alright, I hope that works... if you copy the code, remember to take all the "//"s from the beginning of each line.
     
  3. Ophidian

    Ophidian Thread Starter

    Joined:
    Jul 14, 2001
    Messages:
    119
    Hahaha.... crap... alright now i'm gonna need to know how I can send the code... um, any ideas?
     
  4. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    just post the connection string
     
  5. Ophidian

    Ophidian Thread Starter

    Joined:
    Jul 14, 2001
    Messages:
    119
    Ok we figured out what the problem was and it's now fixed. Thanks for your help anyway.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Problem site
  1. n00e
    Replies:
    2
    Views:
    237
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/61961

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice