Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: CONNECTING ACCESS DATABASE


Message #1 by "Kulsoom Ishtiaque" <kulsoomishtiaque@h...> on Sun, 10 Mar 2002 14:51:00
Hi,

i am making pages on ASP and retreivinng the data in it from Access but 

the problem i m facing is it can't access the data from the data base. so 

if some one could please help me out in it coz its very urgent i have just 

1 day to complete my project... here is im sending the coding i have been 

using....u can see that its the same coding that u people have prvided in 

the wrox book but its not working..y is it soo????????





<!-- METADATA TYPE="typelib" 

              FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -

->

<%







Dim objconn

Set objconn = Server.CreateObject ("ADODB.Connection")

  Dim objConn

  Set objConn = Server.CreateObject("ADODB.Connection")

  objconn.open "DSN=abs"





  If Session("blnValidUser") = True and Session("PersonID") = "" Then

    Dim rsPersonIDCheck

    Set rsPersonIDCheck = Server.CreateObject("ADODB.Recordset")

    Dim strSQL 

    strSQL = "SELECT PersonID FROM Person " & _ 

             "WHERE EMailAddress = '" & Session("EMailAddress") & "';"

    rsPersonIDCheck.Open strSQL, objConn

    If rsPersonIDCheck.EOF Then

      Session("blnValidUser") = False

    Else

      Session("PersonID") = rsPersonIDCheck("PersonID")

    End If

    rsPersonIDCheck.Close

    Set rsPersonIDCheck = Nothing

  End If

%>











and here is the Browse listing file. this is the file that is not 

retreiving the data from data base...y is that soo please check the code 

and reply ASAP!!!!!





<!--#include file="Clssfd.asp"-->

<BASEFONT FACE="Comic Sans MS" COLOR="DarkBlue">

<HTML>

<HEAD>

<TITLE>ABS</TITLE>

</HEAD>



<BODY BGCOLOR="#FFFF80">



<CENTER><H1>ABS<BR>Items for sale</H1>

<% 

  If Session("PersonID") <> "" Then 

    Response.Write "<H3>Welcome " & Session("GivenName") & "</H3>"

  End If 

%>

</CENTER>

<P>Here's a list of books that are currently in the store, (more books 

will be added soon!) 

</P>

<%

  Dim rsItems 

  strSQL = "SELECT * FROM Item " ;

  Set rsItems = Server.CreateObject("ADODB.Recordset")

  rsItems.Open strSQL, objConn

  If Not rsItems.EOF Then

    Response.Write _

      "<TABLE BORDER=""1"" CELLSPACING=""3"" CELLPADDING=""3"">" & _

      "  <TR>" & _

      "    <TH>Item ID" 

               If Session("PersonID") <> "" Then 

                 Response.Write "<BR><FONT SIZE=""-1"">Click to Buy</FONT>"

               End If 

           Response.Write "</TH>" & _

      "    <TH>Name</TH>" & _

      "    <TH>Author Name</TH>" & _

      "    <TH>Description</TH>" & _

      "    <TH>Price</TH>" & _

 

      "  </TR>"

    Do While Not rsItems.EOF

      Response.Write "<TR ALIGN=CENTER>"

      If Session("PersonID") <> "" Then

        Response.Write _ 

          "<TD><A HREF=""Buy.asp?Item=" & rsItems("ItemID") & """>" & _ 

          rsItems("ItemID") & "</A></TD>"

      Else       

        Response.Write "<TD>" & rsItems("ItemID") & "</TD>"

      End If

      Response.Write _ 

        "<TD>" & rsItems("ItemName") & "</TD>" & _

        "<TD>" & rsItems("Author") & "</TD>" & _ 

        "<TD>" & rsItems("Description") & "</TD>" & _

        "<TD>" & FormatCurrency(rsItems("Price")) & "</TD>" & _

     

      "</TR>"

      rsItems.MoveNext

    Loop

    Response.Write "</TABLE>"

    rsItems.close

    Set rsItems = Nothing

  Else  

    Response.Write "<CENTER><H2>No items currently for 

buying</H2></CENTER>"

  End If 

%>

<P>

<HR>

<TABLE BORDER=0 WIDTH=100%>

  <TR ALIGN=CENTER>

    <% If Session("PersonID") <> "" Then %>

      <TD WIDTH=33%>Browse the Books</TD>

    

      <TD WIDTH=33%><A HREF="Register.asp?Update=True">

                    Edit Registration Info</A></TD>

    <% Else  %>

      <TD WIDTH=33%>Browse the Books</TD>

      <TD WIDTH=33%><A HREF="Login.asp">Login</A></TD>

      <TD WIDTH=33%><A HREF="Register.asp">I'm a new user</A></TD>

    <% End If %>

  </TR>

</TABLE>

</BODY>

</HTML>



AWAITING

KULSOOM



Message #2 by Abdul Sami <abdul_sami_20@y...> on Sun, 10 Mar 2002 09:47:54 -0800 (PST)
The semicolon sign at the end of query does not mean anything I

mean this in not Oracle interface.



--- Kulsoom Ishtiaque <kulsoomishtiaque@h...> wrote:

> Hi,

> i am making pages on ASP and retreivinng the data in it from

> Access but 

> the problem i m facing is it can't access the data from the

> data base. so 

> if some one could please help me out in it coz its very urgent

> i have just 

> 1 day to complete my project... here is im sending the coding i

> have been 

> using....u can see that its the same coding that u people have

> prvided in 

> the wrox book but its not working..y is it soo????????

> 

> 

> <!-- METADATA TYPE="typelib" 

>               FILE="C:\Program Files\Common

> Files\SYSTEM\ADO\msado15.dll" -

> ->

> <%

> 

> 

> 

> Dim objconn

> Set objconn = Server.CreateObject ("ADODB.Connection")

>   Dim objConn

>   Set objConn = Server.CreateObject("ADODB.Connection")

>   objconn.open "DSN=abs"

> 

> 

>   If Session("blnValidUser") = True and Session("PersonID") 

> "" Then

>     Dim rsPersonIDCheck

>     Set rsPersonIDCheck 

> Server.CreateObject("ADODB.Recordset")

>     Dim strSQL 

>     strSQL = "SELECT PersonID FROM Person " & _ 

>              "WHERE EMailAddress = '" & Session("EMailAddress")

> & "';"

>     rsPersonIDCheck.Open strSQL, objConn

>     If rsPersonIDCheck.EOF Then

>       Session("blnValidUser") = False

>     Else

>       Session("PersonID") = rsPersonIDCheck("PersonID")

>     End If

>     rsPersonIDCheck.Close

>     Set rsPersonIDCheck = Nothing

>   End If

> %>

> 

> 

> 

> 

> 

> and here is the Browse listing file. this is the file that is

> not 

> retreiving the data from data base...y is that soo please check

> the code 

> and reply ASAP!!!!!

> 

> 

> <!--#include file="Clssfd.asp"-->

> <BASEFONT FACE="Comic Sans MS" COLOR="DarkBlue">

> <HTML>

> <HEAD>

> <TITLE>ABS</TITLE>

> </HEAD>

> 

> <BODY BGCOLOR="#FFFF80">

> 

> <CENTER><H1>ABS<BR>Items for sale</H1>

> <% 

>   If Session("PersonID") <> "" Then 

>     Response.Write "<H3>Welcome " & Session("GivenName") &

> "</H3>"

>   End If 

> %>

> </CENTER>

> <P>Here's a list of books that are currently in the store,

> (more books 

> will be added soon!) 

> </P>

> <%

>   Dim rsItems 

>   strSQL = "SELECT * FROM Item " ;

>   Set rsItems = Server.CreateObject("ADODB.Recordset")

>   rsItems.Open strSQL, objConn

>   If Not rsItems.EOF Then

>     Response.Write _

>       "<TABLE BORDER=""1"" CELLSPACING=""3""

> CELLPADDING=""3"">" & _

>       "  <TR>" & _

>       "    <TH>Item ID" 

>                If Session("PersonID") <> "" Then 

>                  Response.Write "<BR><FONT SIZE=""-1"">Click to

> Buy</FONT>"

>                End If 

>            Response.Write "</TH>" & _

>       "    <TH>Name</TH>" & _

>       "    <TH>Author Name</TH>" & _

>       "    <TH>Description</TH>" & _

>       "    <TH>Price</TH>" & _

>  

>       "  </TR>"

>     Do While Not rsItems.EOF

>       Response.Write "<TR ALIGN=CENTER>"

>       If Session("PersonID") <> "" Then

>         Response.Write _ 

>           "<TD><A HREF=""Buy.asp?Item=" & rsItems("ItemID") &

> """>" & _ 

>           rsItems("ItemID") & "</A></TD>"

>       Else       

>         Response.Write "<TD>" & rsItems("ItemID") & "</TD>"

>       End If

>       Response.Write _ 

>         "<TD>" & rsItems("ItemName") & "</TD>" & _

>         "<TD>" & rsItems("Author") & "</TD>" & _ 

>         "<TD>" & rsItems("Description") & "</TD>" & _

>         "<TD>" & FormatCurrency(rsItems("Price")) & "</TD>" & _

>      

>       "</TR>"

>       rsItems.MoveNext

>     Loop

>     Response.Write "</TABLE>"

>     rsItems.close

>     Set rsItems = Nothing

>   Else  

>     Response.Write "<CENTER><H2>No items currently for 

> buying</H2></CENTER>"

>   End If 

> %>

> <P>

> <HR>

> <TABLE BORDER=0 WIDTH=100%>

>   <TR ALIGN=CENTER>

>     <% If Session("PersonID") <> "" Then %>

>       <TD WIDTH=33%>Browse the Books</TD>

>     

>       <TD WIDTH=33%><A HREF="Register.asp?Update=True">

>                     Edit Registration Info</A></TD>

>     <% Else  %>

>       <TD WIDTH=33%>Browse the Books</TD>

>       <TD WIDTH=33%><A HREF="Login.asp">Login</A></TD>

>       <TD WIDTH=33%><A HREF="Register.asp">I'm a new

> user</A></TD>

>     <% End If %>

>   </TR>

> </TABLE>

> </BODY>

> </HTML>

> 

> AWAITING

> KULSOOM

> 

> 




$subst('Email.Unsub').





=====

Abdul Sami



__________________________________________________

Do You Yahoo!?

Try FREE Yahoo! Mail - the world's greatest free email!

http://mail.yahoo.com/

Message #3 by "Zee Computer Consulting" <zee@t...> on Sun, 10 Mar 2002 17:15:40 -0800
Please send the actual error message and the program code that caused  it.



-- Z





----- Original Message -----

From: "Kulsoom Ishtiaque" <kulsoomishtiaque@h...>

To: "Access ASP" <access_asp@p...>

Sent: Sunday, March 10, 2002 2:51 PM

Subject: [access_asp] CONNECTING ACCESS DATABASE





> Hi,

> i am making pages on ASP and retreivinng the data in it from Access but

> the problem i m facing is it can't access the data from the data base. so

> if some one could please help me out in it coz its very urgent i have just

> 1 day to complete my project... here is im sending the coding i have been

> using....u can see that its the same coding that u people have prvided in

> the wrox book but its not working..y is it soo????????

>

>

> <!-- METADATA TYPE="typelib"

>               FILE="C:\Program Files\Common

Files\SYSTEM\ADO\msado15.dll" -

> ->

> <%

>

>

>

> Dim objconn

> Set objconn = Server.CreateObject ("ADODB.Connection")

>   Dim objConn

>   Set objConn = Server.CreateObject("ADODB.Connection")

>   objconn.open "DSN=abs"

>

>

>   If Session("blnValidUser") = True and Session("PersonID") = "" Then

>     Dim rsPersonIDCheck

>     Set rsPersonIDCheck = Server.CreateObject("ADODB.Recordset")

>     Dim strSQL

>     strSQL = "SELECT PersonID FROM Person " & _

>              "WHERE EMailAddress = '" & Session("EMailAddress") & "';"

>     rsPersonIDCheck.Open strSQL, objConn

>     If rsPersonIDCheck.EOF Then

>       Session("blnValidUser") = False

>     Else

>       Session("PersonID") = rsPersonIDCheck("PersonID")

>     End If

>     rsPersonIDCheck.Close

>     Set rsPersonIDCheck = Nothing

>   End If

> %>

>

>

>

>

>

> and here is the Browse listing file. this is the file that is not

> retreiving the data from data base...y is that soo please check the code

> and reply ASAP!!!!!

>

>

> <!--#include file="Clssfd.asp"-->

> <BASEFONT FACE="Comic Sans MS" COLOR="DarkBlue">

> <HTML>

> <HEAD>

> <TITLE>ABS</TITLE>

> </HEAD>

>

> <BODY BGCOLOR="#FFFF80">

>

> <CENTER><H1>ABS<BR>Items for sale</H1>

> <%

>   If Session("PersonID") <> "" Then

>     Response.Write "<H3>Welcome " & Session("GivenName") & "</H3>"

>   End If

> %>

> </CENTER>

> <P>Here's a list of books that are currently in the store, (more books

> will be added soon!)

> </P>

> <%

>   Dim rsItems

>   strSQL = "SELECT * FROM Item " ;

>   Set rsItems = Server.CreateObject("ADODB.Recordset")

>   rsItems.Open strSQL, objConn

>   If Not rsItems.EOF Then

>     Response.Write _

>       "<TABLE BORDER=""1"" CELLSPACING=""3"" CELLPADDING=""3"">" & _

>       "  <TR>" & _

>       "    <TH>Item ID"

>                If Session("PersonID") <> "" Then

>                  Response.Write "<BR><FONT SIZE=""-1"">Click to

Buy</FONT>"

>                End If

>            Response.Write "</TH>" & _

>       "    <TH>Name</TH>" & _

>       "    <TH>Author Name</TH>" & _

>       "    <TH>Description</TH>" & _

>       "    <TH>Price</TH>" & _

>

>       "  </TR>"

>     Do While Not rsItems.EOF

>       Response.Write "<TR ALIGN=CENTER>"

>       If Session("PersonID") <> "" Then

>         Response.Write _

>           "<TD><A HREF=""Buy.asp?Item=" & rsItems("ItemID") & """>" & _

>           rsItems("ItemID") & "</A></TD>"

>       Else

>         Response.Write "<TD>" & rsItems("ItemID") & "</TD>"

>       End If

>       Response.Write _

>         "<TD>" & rsItems("ItemName") & "</TD>" & _

>         "<TD>" & rsItems("Author") & "</TD>" & _

>         "<TD>" & rsItems("Description") & "</TD>" & _

>         "<TD>" & FormatCurrency(rsItems("Price")) & "</TD>" & _

>

>       "</TR>"

>       rsItems.MoveNext

>     Loop

>     Response.Write "</TABLE>"

>     rsItems.close

>     Set rsItems = Nothing

>   Else

>     Response.Write "<CENTER><H2>No items currently for

> buying</H2></CENTER>"

>   End If

> %>

> <P>

> <HR>

> <TABLE BORDER=0 WIDTH=100%>

>   <TR ALIGN=CENTER>

>     <% If Session("PersonID") <> "" Then %>

>       <TD WIDTH=33%>Browse the Books</TD>

>

>       <TD WIDTH=33%><A HREF="Register.asp?Update=True">

>                     Edit Registration Info</A></TD>

>     <% Else  %>

>       <TD WIDTH=33%>Browse the Books</TD>

>       <TD WIDTH=33%><A HREF="Login.asp">Login</A></TD>

>       <TD WIDTH=33%><A HREF="Register.asp">I'm a new user</A></TD>

>     <% End If %>

>   </TR>

> </TABLE>

> </BODY>

> </HTML>

>

> AWAITING

> KULSOOM

>

>




$subst('Email.Unsub').

>




  Return to Index