Just to cut straight to the heart of the problem: I only recently started working with asp because my current employer's website was built using asp.net and he requested I make some changes to the design/layout. In addition to the website there's also a kind of front-end content manager to make updating text content easier, however the code that allows existing content to be deleted appears to be broken and with my current knowledge of asp, I'm unable to fix it.
I'm hoping someone on here can offer me some advice...

Here's the error message when we try to access the page in question:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/manager/listnewproducts.asp, line 38

And here's the code that controls the page:

<%@ Language=VBScript %>
<!--#include file="adovbs.inc"-->
<!--#include file="checkpassword.asp"-->

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



<body bgcolor="#CCCCCC" text="#CC0066" leftmargin="0" topmargin="0" link="#CC0066" vlink="#CC0066" alink="#CC0066">
<table width="780" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
  <tr>
    <td valign="top" bgcolor="fffffff">
      <div align="center">
        <table width="100%" border=0 cellpadding="0" cellspacing="0" align="center">
          <tr >
            <td colspan="2">
              <!--#include file="mannav.asp"-->
            </td>
          </tr>
          <tr bgcolor="EAE9FB">
            <td align="center" bgcolor="f6821f" height="15">
              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"></font></div>
              <div align="left"><font face="Arial" size="3" color="#FFFFFF"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Delete
                Articles </font></b></font></div>
              </td>
          </tr>
          <tr bgcolor="EAE9FB">
            <td align="center" bgcolor="ffffff">
              <%
	'Open a connection to the database
	Dim objConn
	Set objConn = Server.CreateObject("ADODB.Connection")
	objConn.ConnectionString = "DSN=blankDSN"
	'objConn.Open

	'Get the table information for products
	Dim objRS
	Set objRS = Server.CreateObject("ADODB.Recordset")
	'objRS.Open "newproducts ORDER BY roomType asc, xdate desc", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable

	'Display the FORM and the top of the TABLE
	Response.Write "<body bgcolor=#CCCCCC>"
	Response.Write "<FORM METHOD=POST ACTION=""deletenewproducts.asp"">"
	Response.Write "<center>"
	Response.Write "<TABLE BORDER=""1"" CELLSPACING=""0"" cellpadding=""3"" bgcolor=""white"" width=""100%"">"

	Dim iLoop


	'Display each element in the table...
	'Do While Not objRS.EOF
		'Response.Write "<TR>" & vbCrLf

		'Create a checkbox to check for deleting, setting the checkboxes
		'Value equal to the current items ProductID
		Response.Write "<TD VALIGN=TOP><INPUT TYPE=CHECKBOX NAME=Delete "
		Response.Write "VALUE=" & CInt(objRS("id")) & "></TD>"

		'Display the name and cost of the product
		Response.Write vbCrLf & "<TD VALIGN=TOP width=""10%""><font face=Verdana, Arial, Helvetica, sans-serif size=1 color=#0000FF>" & objRS( "xdate" ) & "</font></TD>"
		Response.Write vbCrLf & "<TD VALIGN=TOP width=""8%""><font face=Verdana, Arial, Helvetica, sans-serif size=1 color=#0000FF>" & objRS( "Carname" ) & "</font></TD>"
		Response.Write vbCrLf & "<TD VALIGN=TOP width=""15%""><font face=Verdana, Arial, Helvetica, sans-serif size=1 color=#0000FF>" & objRS( "xYear" ) & "</font></TD>"
		Response.Write vbCrLf & "<TD VALIGN=TOP width=""67%""><font face=Verdana, Arial, Helvetica, sans-serif size=1 color=#0000FF>" & objRS( "summary" ) & "</font></TD>"
		Response.Write "</TD></TR>" & vbCrLf & vbCrLf

		'Move to the next record...
		objRS.MoveNext
	Loop

	'Print the end of the table, the submit button, and the
	'the end of the form.
	Response.Write "</TABLE>"
	Response.Write "<P><INPUT TYPE=SUBMIT VALUE=""Delete Selected Projects"">"
	Response.Write "</FORM>"


	'Clean up our ADO objects
	objRS.Close
	Set objRS = Nothing

	objConn.Close
	Set objConn = Nothing
%>
            </td>
          </tr>
        </table>
      </div>
    </td>
  </tr>
  <tr valign="middle" bgcolor="537975">
    <td height="15" bgcolor="#999999">

    </td>
  </tr>
</table>
</body>
</html>

Any help would be appreciated.

Hi Gary,

It looks like your problem is the connection to the database.

'Open a connection to the database
	Dim objConn
	Set objConn = Server.CreateObject("ADODB.Connection")
	objConn.ConnectionString = "DSN=blankDSN"
	'objConn.Open

The first thing to check is to see if there is actually a DSN on the server. If not, the connection you have is wrong. You can do a DSNless connection as follows:

Dim objconn	
objconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & _
				server.mappath("/Databasename.mdb"))	
objconn.Open()

Note: if the database is not in the root of your site, you need to include the subdirectory as well.
Additionally, at the top of your page, right before the two include statements put

<%@ Import Namespace="System.Data.OleDb" %>

Sue

Thanks for the help Sue.

I think the DSN file itself isn't there and that's what's causing the problem. I'm trying to get in touch with our host or the person who originally coded the site to get the relevant info.

Unfortunately it doesn't seem to accept the DSNless connection even though the database file seems to be there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.