Scripting: ASP problem

started by Dave on Jul 23, 2004 — RSS Feed

Dave Dave
Posts: 6

Hi

I have set up a simple database and want to query it using hyperlinks. The code has been written in asp. When i click on a hyperlink, i want a page to appear with corresponding records in the database.

The hyperlinks look like this:

<a href="connect.asp?qsname=customer">Click here to view customer related attributes</a><br>
<a href="connect.asp?qsname=product">Click here to view product related attributes</a> <br>
<a href="connect.asp?qsname=service">Click here to view service related attributes</a>

The asp page conatins the following code:

<HTML>
<BODY>
<B>Here are the realted attributes:</B><BR><br>
<%
Set MyConn = Server.CreateObject("ADODB.Connection"
MyConn.Open "FILEDSN=csnmytable_dsn.dsn"
SQL_query = "SELECT * FROM Friends where Name=qsname"
Set RS = MyConn.Execute(SQL_query)
WHILE NOT RS.EOF
%>
<%=RS("Name"%>--<%=RS("Link"%><br>
<%
RS.MoveNext
WEND
RS.Close
MyConn.Close
%>
</BODY>
</HTML>

When i click on a hyperlink i get the follwing error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/webpub/connect.asp, line 8

The database is very simple. It has a table called 'Friends' and this contains 2 fields - 'Name' and 'Link'.

Any help would be greatly appreciated

Thanks in advance

Dave

Mrblack Mrblack
Posts: 40

Dave, this code is referring to a DSN; has the DSN been configured on your webserver?

Dave Dave
Posts: 6

Hi

Thanks for the reply - ive somehow managed to get the code working now

Cheers

Dave

You must login to reply