Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ASP SQL problems
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ASP SQL problems

 Post Reply Post Reply
Author
pjb007 View Drop Down
Groupie
Groupie


Joined: 03 September 2004
Location: United Kingdom
Status: Offline
Points: 185
Post Options Post Options   Thanks (0) Thanks(0)   Quote pjb007 Quote  Post ReplyReply Direct Link To This Post Topic: ASP SQL problems
    Posted: 16 June 2005 at 11:27am
I am having problems with some ASL/SQL but I can't post here, I type the message put the code in the CODE tags put the subject and it says I must type a message.  Is there somewhere I can post me code for a sombody to take a look at it?
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2005 at 11:51am
Code tags have been a little flakey lately - it is an alpha forume - lol.

Try putting it in quote tags.

Lead me not into temptation... I know the short cut, follow me.
Back to Top
pjb007 View Drop Down
Groupie
Groupie


Joined: 03 September 2004
Location: United Kingdom
Status: Offline
Points: 185
Post Options Post Options   Thanks (0) Thanks(0)   Quote pjb007 Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2005 at 12:03pm
I get the same error message
Back to Top
pjb007 View Drop Down
Groupie
Groupie


Joined: 03 September 2004
Location: United Kingdom
Status: Offline
Points: 185
Post Options Post Options   Thanks (0) Thanks(0)   Quote pjb007 Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2005 at 12:05pm
The error I get is
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/peterbonduk/links_test.asp, line 38
 
Error shown in Bold Red Text
 

<table width="100%"  border="0">

  <tr>
   
<td colspan="2"><!--#include file="nav/titles/hometitle.asp" --> <hr /></td>

  </tr>
  <tr>

    <td width="20%" valign="top"><!--#include file="nav/menus/indexmenu.asp" --></td>

    <td width="80%" valign="top"><p class="kwd4"><strong>Computer Links</strong><br />
      <%
dim Conn 
dim FilePath 
dim SQL
dim RSUser 
dim Counter
 
'Connection to Database
Set Conn = Server.CreateObject("ADODB.Connection")
FilePath = Server.MapPath("db/db1.mdb")
Conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & FilePath & ";"
 

'SQL Query String

if request("state") = "computer" then
SQL = "Select * FROM tbl_linkstest WHERE display=yes AND cat=computer ORDER BY titletext ASC"

end if
 
'Set the Recordset
Set RSUser = Conn.Execute (SQL)
 
'Print the Recordset
RSUser.Movefirst
%>
     
    </p>

      <table width="100%">
<%Do While not RSUser.eof%>
<tr class="kwd4">

<td width="50%"><% Response.Write ("<a href=""" & "http://" & RSUser("url") & """ target=""_blank"">") & RSUser("titletext") & ("</a>") %></td>

<% RSUser.MoveNext
if RSUser.EOF then %>
<td width="50%">&nbsp;</td>
<tr class="kwd4">

<td width="100%" colspan="2">&nbsp;</td>
<% Exit Do
else %>
<td width="50%"><% Response.Write ("<a href=""" & "http://" & RSUser("url") & """ target=""_blank"">") & RSUser("titletext") & ("</a>") %></td>

<% RSUser.MoveNext
end if%>
</tr>
<tr class="kwd4">
<td width="100%" colspan="2">&nbsp;</td>
</tr>
<% Loop %>
</table>


Edited by pjb007 - 16 June 2005 at 1:21pm
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2005 at 1:02pm
before the red part ypu meed to make it a recordset ie

Set RSUser= Server.CreateObject("ADODB.RecordSet")
Back to Top
pjb007 View Drop Down
Groupie
Groupie


Joined: 03 September 2004
Location: United Kingdom
Status: Offline
Points: 185
Post Options Post Options   Thanks (0) Thanks(0)   Quote pjb007 Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2005 at 1:20pm
The error I get now is
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/peterbonduk/links_test.asp, line 39
 
Error shown in Bold Red Text

<table width="100%"  border="0">

  <tr>
   
<td colspan="2"><!--#include file="nav/titles/hometitle.asp" --> <hr /></td>

  </tr>
  <tr>

    <td width="20%" valign="top"><!--#include file="nav/menus/indexmenu.asp" --></td>

    <td width="80%" valign="top"><p class="kwd4"><strong>Computer Links</strong><br />
      <%
dim Conn 
dim FilePath 
dim SQL
dim RSUser 
dim Counter
 
'Connection to Database
Set Conn = Server.CreateObject("ADODB.Connection")
FilePath = Server.MapPath("db/db1.mdb")
Conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & FilePath & ";"
 

'SQL Query String

if request("state") = "computer" then
SQL = "Select * FROM tbl_linkstest WHERE display=yes AND cat=computer ORDER BY titletext ASC"

end if
 
'Set the Recordset
Set RSUser= Server.CreateObject("ADODB.RecordSet")
Set RSUser = Conn.Execute (SQL)
 
'Print the Recordset
RSUser.Movefirst
%>
     
    </p>

      <table width="100%">
<%Do While not RSUser.eof%>
<tr class="kwd4">

<td width="50%"><% Response.Write ("<a href=""" & "http://" & RSUser("url") & """ target=""_blank"">") & RSUser("titletext") & ("</a>") %></td>

<% RSUser.MoveNext
if RSUser.EOF then %>
<td width="50%">&nbsp;</td>
<tr class="kwd4">

<td width="100%" colspan="2">&nbsp;</td>
<% Exit Do
else %>
<td width="50%"><% Response.Write ("<a href=""" & "http://" & RSUser("url") & """ target=""_blank"">") & RSUser("titletext") & ("</a>") %></td>

<% RSUser.MoveNext
end if%>
</tr>
<tr class="kwd4">
<td width="100%" colspan="2">&nbsp;</td>
</tr>
<% Loop %>
</table>


Oh I am using an if statement for the SQL as I will add other areas later.  Basically what comes after cat= will change so

cat=computer
cat=shopping
cat=forums
cat=games

and so on.


Edited by pjb007 - 16 June 2005 at 1:23pm
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 19 June 2005 at 7:15pm
instead of
 
Set RSUser = Conn.Execute (SQL)

try

RSUser.open sql, Conn
 
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.