Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 2nd, 2003, 03:31 PM
Registered User
 
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jasmine5544
Default Deleting info from Database...

I have this code I have been working with, however I TOTALLY don't understand the Conn.open part of this. I have tried doing what the book I have says, and peoples suggestions but don't understand what the heck. What am I missing? :(

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>


<%
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "tblMain"
    strDelete = "DELETE FROM tblMain WHERE strID = " & Request("strID")
    Conn.Execute(strDelete)
    Conn.Close

%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
Redirecting ... Please Wait
<% 'redirect main page
        response.redirect "admin_main.asp"
%>
<body>
</body>
</html>


 
Old December 2nd, 2003, 03:43 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

What you're missing is a connection string. You should use the Open method and pass it a connection string, so it knows what database to access. Right now, it looks like you're trying to pass it the name of the table, which is not going to work.

Take a look at the following pages:

http://support.microsoft.com:80/supp...NoWebContent=1

http://msdn.microsoft.com/library/de...asp?frame=true

Once you understand a bit more about how connections work, and how you should pass a connection string to the Open method, take a look here for a more up-to-date connection string (the one mentioned in the first article is out-dated):

http://www.able-consulting.com/MDAC/...orMicrosoftJet

HtH,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting a row in MySQL database mattw1100 Beginning PHP 3 August 21st, 2008 05:28 PM
Adding and Deleting info from Datagrid toddw607 ASP.NET 2.0 Basics 2 April 20th, 2007 10:40 AM
Help me in deleting value from database and grid [email protected] ASP.NET 1.0 and 1.1 Basics 0 December 27th, 2006 02:43 AM
deleting entire database x_ray Classic ASP Basics 3 April 4th, 2006 03:02 PM
Deleting data from database jaideepc ADO.NET 0 August 11th, 2004 04:04 AM





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