Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #21 (permalink)  
Old February 22nd, 2007, 12:44 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bonkbc Send a message via Yahoo to bonkbc
Default

Hi...this website has only connection strings for access 2007, but I only have Access 2003. I don't think they are compatible. Do you know if this is the case?

Reply With Quote
  #22 (permalink)  
Old February 22nd, 2007, 12:47 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I havent used access in a long long long time, but you SHOULD be ok. I suggest using the JET driver.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
Reply With Quote
  #23 (permalink)  
Old February 22nd, 2007, 12:58 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bonkbc Send a message via Yahoo to bonkbc
Default

Hi, I'm in the process of setting up the JET driver. But, this leads me to 2 more stupid questions (sorry, I'm a novice!)

1.) I have to give a pathway for the database. When I put this DB on a server somewhere, I'm not sure what the path should be and how specific it needs to be. For example, can I just put the directory that the DB is in on the SERVER or do I need to put the server's IP address or anything on there?

2.) Do I need to include the code for the JET driver in every .asp file that I write that includes a database connection/interaction? Or does it connect once, and then it's opened and saved in the cache somewhere? I'm not sure if this question will even make any sense to you.

thanks again

Reply With Quote
  #24 (permalink)  
Old February 22nd, 2007, 01:24 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

No you have to open it everytime you want to use it.

To supply the path to the database you would use Server.MapPath(<relative path to database from current directory>)

So if your database is in a folder called dbase in the root directory and you are opening a connect to the database on a page that is in your root directory your statement would be

Server.MapPath("./dbase/file.mdb")

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
Reply With Quote
  #25 (permalink)  
Old February 22nd, 2007, 01:29 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bonkbc Send a message via Yahoo to bonkbc
Default

just out of shear curiousity...

what does the "./" in this line: Server.MapPath("./dbase/file.mdb")
tell the server?

thanks for humoring me

Reply With Quote
  #26 (permalink)  
Old February 22nd, 2007, 01:53 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

A folder that exists in the current directory.

../dbase/file.mdb
tells the server that the dbase directory is one level higher then the current directory.


================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
Reply With Quote
  #27 (permalink)  
Old February 22nd, 2007, 04:01 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bonkbc Send a message via Yahoo to bonkbc
Default

Hi Everybody,

I've been trying to work out some SQL / .asp interactions, where I have a form page that is populated by products in a database. On this page, I can successfully connect to database, and SQL works to the point where I can print a list of the prods to a page. On the page, each prod has a checkbox next to it. If you check some boxes and then hit send, the items checked are passed to another .asp page that handles the data. This page creates an SQL script that looks like

sql = "DELETE FROM prod WHERE listnum IN ("

...a loop fills the IN list with the request.form checkbox entries.

I continually get errors no matter WHAT I've tried on this data handler page.

Here is the code from the intial form page:

<%@ Language=VBscript %>
<% Option Explicit%>
<% Response.Buffer = true %>



<%
dim prod(100)
dim listnum(100)
dim c
c=1
Dim Conn, Rs, sql

sql = "SELECT * FROM prod"

Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("milinternational.mdb")
Rs.Open sql, Conn

while not Rs.eof
    prod(c) = Rs("product")
    listnum(c) = Rs("listnum")
    rs.movenext
    c = c+1
wend


%>
<html>
<head>
<title>Mil International - Administrator Only</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
    <table cellpadding="3" cellspacing="3" border="1" align="center">
        <tr>
            <td colspan="3">Mil International Products List</td>
        </tr>

        <tr>
            <td></td><td>List #</td><td>Product Name</td>
        </tr>
        <% dim i
            c = c-1
        %>
        <form action="delhandle2.asp" method="post">
        <%for i = 1 to c %>
                <tr>
                    <td><INPUT TYPE=CHECKBOX NAME="listnum" value="<%=listnum(i)%>"></td><td></td><td><% response.write(prod(i)) %> </td>
                </tr>
        <% Next %>
        <input type="submit" name="submit" value="Send">
        </form>
    </table>
<%
Rs.Close
Set Rs = Nothing
Set Conn = Nothing
%>

</body>
</html>

AND here is the code from the DATA handler page:

<%@ Language=VBscript %>
<% Option Explicit%>
<% Response.Buffer = true %>



<%
    dim counter
    counter=1
    dim del(100)
    dim x
    dim del_list
    dim add
    del_list = ""
    dim upper
    upper=request.Form("listnum").count

    Dim Conn, Rs, sql
    sql = "DELETE FROM prod WHERE listnum IN ("

    if upper >= 1 then
        For counter = 1 To Request.Form("listnum").Count-1
          del_list = del_list & Request.Form("listnum")(counter) & "," &""
        Next
        del_list=del_list+Request.Form("listnum")(counter)
    end if
    sql = sql&del_list&")"

    Set Conn = Server.CreateObject("ADODB.Connection")
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("milinternational.mdb")
    Rs.Open sql, Conn

    Rs.Close
    Set Rs = Nothing
    Set Conn = Nothing

    response.Redirect("index.html")
%>

Why can I succesfully open the DB and print from it in the first page...but in the 2nd page, something crashes? This leads me to believe that my connection to the DB is not the issue. I think it is the SQL. What do you think?

I did a test to see exactly what the SQL script was by simply response.write it to the screen...to make sure the loops and the request.form was working. This is the result(when checking only boxes 1 and 2):

DELETE FROM prod WHERE listnum IN (1,2)

I'm struggling here and getting frustrated. ANY help would be greatly greatly appreciated. Thank you for your time! : )

-Brian

Reply With Quote
  #28 (permalink)  
Old February 22nd, 2007, 04:43 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Do you have Write permissions to the database?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
Reply With Quote
  #29 (permalink)  
Old February 22nd, 2007, 05:35 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bonkbc Send a message via Yahoo to bonkbc
Default

Yes...but the only way I know of checking for this is by right-clicking on the .mdb file, selecting "properties" and un-checking the "read only" attribute. It is unchecked, but this is the extent of my knowledge as far as read/write permissions are concerned. I could be wrong?

thank you for your help,
brian

Reply With Quote
  #30 (permalink)  
Old February 22nd, 2007, 05:41 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Take a look here: http://www.spaanjaars.com/QuickDocId.aspx?quickdoc=263

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
parametising sql statements in ASP classic trufla Classic ASP Basics 5 June 18th, 2008 02:38 PM
CASE Statements in T-SQL atcs2152 SQL Server 2000 3 April 28th, 2006 10:53 AM
Sql statements in data adapter Raif ASP.NET 1.0 and 1.1 Basics 1 July 14th, 2004 08:50 AM
SQL Statements marmer Classic ASP Basics 3 November 13th, 2003 01:42 AM
Quoting variables in SQL statements tp194 Classic ASP Databases 1 July 4th, 2003 03:41 AM



All times are GMT -4. The time now is 01:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.