ASP woes

Soldato
Joined
20 Oct 2002
Posts
16,095
Location
North West
I'm trying to work my way through a tutorial provided by the university. This basically allows you to convert a table from Access to ASP (exporting the table to ASP). Now I export the table to asp and put it into my local host folder. The problem is when I run it through FF it screws up (http://localhost/Assignment/Categories.asp)


Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/assignment/Categories.asp, line 12

any ideas?

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=windows-1252">
<TITLE>Categories</TITLE>
</HEAD>
<BODY>
<%
If IsObject(Session("NetskillsDB_conn")) Then
Set conn = Session("NetskillsDB_conn")
Else
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "NetskillsDB","",""
Set Session("??NetskillsDB_conn") = conn
End If
%>
<%
If IsObject(Session("Categories_rs")) Then
Set rs = Session("Categories_rs")
Else
sql = "SELECT * FROM [Categories]"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 3, 3
If rs.eof Then
rs.AddNew
End If
Set Session("Categories_rs") = rs
End If
%>
<TABLE BORDER=1 BGCOLOR=#ffffff CELLSPACING=0><FONT FACE="Arial" COLOR=#000000><CAPTION><B>Categories</B></CAPTION></FONT>

<THEAD>
<TR>
<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial" COLOR=#000000>Category ID</FONT></TH>
<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial" COLOR=#000000>Category Name</FONT></TH>
<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial" COLOR=#000000>Description</FONT></TH>
<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial" COLOR=#000000>Picture</FONT></TH>

</TR>
</THEAD>
<TBODY>
<%
On Error Resume Next
rs.MoveFirst
do while Not rs.eof
%>
<TR VALIGN=TOP>
<TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><FONT style=FONT-SIZE:10pt FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("CategoryID").Value)%><BR></FONT></TD>
<TD BORDERCOLOR=#c0c0c0 ><FONT style=FONT-SIZE:10pt FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("CategoryName").Value)%><BR></FONT></TD>
<TD BORDERCOLOR=#c0c0c0 ><FONT style=FONT-SIZE:10pt FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("Description").Value)%><BR></FONT></TD>
<TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><FONT style=FONT-SIZE:10pt FACE="Arial" COLOR=#000000><BR></FONT></TD>

</TR>
<%
rs.MoveNext
loop%>
</TBODY>
<TFOOT></TFOOT>
</TABLE>
</BODY>
</HTML>
 
Doh, you seem be using a DSN connection. Ok, you need to setup the DSN on the PC you are running this code on.

http://www.webcheatsheet.com/asp/dsn.php - Look at this tutorial.

dsn_1.gif


With the above screenshot you should have a DSN (System Data Source Name) called "NetskillsDB_conn" which you are referring to in your code. If not you need to follow the guide or speak to your university.
 
Robert said:
I've got it working :D

Well it displays correctly :D

Thanks for your help noob :)

No problem mate, if you have any other problems let me know.

BTW it seems weird your uni is teaching you ASP, it is inferior compared to .NET.
 
Last edited:
Back
Top Bottom