PDA

View Full Version : new to ASP - help



barreledaction
07 Jun 2006, 01:04 PM
I get this message:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/displaystock.asp, line 32
-----------------------------------------------------------------------
below is my code. Would someone please tell me what is wrong? - and how to correct

<%@ language = javascript%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>look up data in inventory</title>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 5.50.4522.1800" name=GENERATOR>
</HEAD>
<BODY>
<center>
<font size="+1"><b><br><br>Inventory Search/Maintenance</b></font><p>
<table border=1>
<thead>
<tr>
<th>Id#</th>
<th>Make</th>
<th>Model</th>
<th>Series</th>
<th>Description</th>
<th>Color</th>
<th>Qty</th>
<th>Cost</th>
<th>Price</th>
<th></th>
</tr>
</thead>
<%
// open connection to database, then populate a recordset with list of stock
var adoConnection = Server.CreateObject("ADODB.Connection");
var adoRecordSet;
var mySQL;
adoConnection.Open("DSN=inventorydb");
var mySQL = "select stockId, make, model, description, series, color, qty, cost, price" + "from stock";
adoRecordSet = adoConnection.Execute(mySQL);
// loop through recordset and write stock details out to page
while ( adoRecordSet.Eof == false )
{
%>
<tr>
<td><%=adoRecordSet("stockId").Value%></td>
<td><%=adoRecordSet("make").Value%></td>
<td><%=adoRecordSet("model").Value%></td>
<td><%=adoRecordSet("description").Value%></td>
<td><%=adoRecordSet("series").Value%></td>
<td><%=adoRecordSet("color").Value%></td>
<td><%=adoRecordSet("qty").Value%></td>
<td><%=adoRecordSet("cost").Value%></td>
<td><%=adoRecordSet("price").Value%></td>
<td><a href="neworders.asp?stockId=<%=adoRecordSet("stockId").Value%>">
Use this</a></td>
</tr>
<%
adoRecordSet.MoveNext();
}

// close recordset and connections
// and release memory used by recordset and connections objects
adoRecordSet.Close();
adoRecordSet = null;
adoConnection.Close();
adoConnection = null;
%>
</table>
</center>
</body>
</html>

DanInManchester
08 Jun 2006, 07:20 AM
check the DSN exists and is setup correctly and if you are sure that is corect get back to me.

Personally I avoid DSN and use connection strings as they are fster and lower maintenance....
http://www.connectionstrings.com/ is a good place to start.