Go Back   SitePoint Forums > Forum Index > Program Your Site > Classic ASP
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Sep 14, 2004, 00:43   #1
Wan
SitePoint Enthusiast
 
Wan's Avatar
 
Join Date: Sep 2004
Location: kl
Posts: 42
too few parameters

I have no idea where was I wrong. This is my coding...

<%@ language="VBScript" %>
<% Option Explicit %>
<%
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = &H0001

Dim strURL, strSearch
strURL = Request.ServerVariables("URL")
strSearch = Request.QueryString("nama")
strSearch = Replace(strSearch, "'", "''")
%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Sistem Pinjaman Peralatan &amp; Perisian - Pengesahan Pinjaman</title>
</head>
<body bgcolor="#FFE6FF">
<table border="0" width="100%" height="41">
<tr>
<td width="5%" height="37">
<p align="center"></td>
<td width="15%" height="37">
<p align="right"><img border="0" src="images/mpsp_logo.jpg"></td>
<td width="80%" height="37"><font color="#8A3871"><!--webbot bot="Ws3FpEx"
startspan clientside moduleid="'sistem pinjaman (Project)\banner.xws'"
PREVIEW="<img src='images/banner.gif?01685B6B' editor='Webstyle3' border='0'>" --><img src="images/banner.gif?01685B6B" editor="Webstyle3" border="0"><!--webbot
bot="Ws3FpEx" i-CheckSum="36575" endspan -->
</font></td>
</tr>
</table>
<p align="center">
<!--webbot clientside
bot="Ws3FpEx" moduleid="'sistem pinjaman (Project)\divider.xws'" PREVIEW="<img src='images/divider.gif?00F35C30' editor='Webstyle3' border='0'>" startspan --><img src="images/divider.gif?00F35C30" editor="Webstyle3" border="0"><!--webbot
bot="Ws3FpEx" i-CheckSum="51209" endspan --></p>
<table border="0" width="100%">
<tr>
<td width="100%">
<p align="center"><b><font color="#8A3871">Masukkan nama anda untuk melihat status permohonan.</font></b></p>
<form method="GET" action="<%= strURL %>">
<p align="center"><font color="#8A3871"><b>Nama : </b></font> <input type="text" name="nama" size="27"></p>
<%
If strSearch <> "" Then
Dim Conn, Rs, sSQL, RsCount
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.open "DRIVER=Microsoft Access Driver (*.mdb); DBQ="& Server.MapPath("sistem.mdb")
sSQL = "SELECT * " _
& "FROM mohon " _
& "WHERE pemohon LIKE " & Replace(strSearch, "'", "''") & " " _
& "AND status = ON " _
& "ORDER BY Bil DESC;"

Rs.Open sSQL, Conn, adOpenStatic, adLockReadOnly, adCmdText

RsCount = Rs.RecordCount
If RsCount = 0 Then
%>
<hr>
<table border="0" width="100%">
<tr>
<td width="15%"></td>
<td width="70%">
<p align="center"><b><font color="#8A3871">Pastikan anda menulis nama yang betul.</font></b></p>
<p align="center"><b><font color="#8A3871">Nama yang anda telah tulis tiada dalam rekod permohonan.</font></b></p>
<%
Else
If Rs.lulus = "Lulus" Then
Response.write "<p align='center'><b>Permohonan anda diluluskan.</b></p>"
Else
Response.write "<p align='center'><b>Permohonan anda tidak diluluskan.</b></p>"
Response.write "<p align='center'><b>" & Rs("catatan") & "</b></p>"
End If
%>
<table border="1" width="100%" height="150">
<tr>
<td width="50%" height="19" align="center"><b><font color="#8A3871">Nama pemohon</font></b></td>
<td width="50%" height="19">&nbsp;&nbsp;&nbsp;<%= Rs.Fields("pemohon").Value %></td>
</tr>
<tr>
<td width="50%" height="19" align="center"><b><font color="#8A3871">Peralatan yang dimohon</font></b></td>
<td width="50%" height="19">&nbsp;&nbsp;&nbsp;<%= Rs.Fields("peralatan").Value %></td>
</tr>
<tr>
<td width="50%" height="19" align="center"><b><font color="#8A3871">Tarikh peminjaman</font></b></td>
<td width="50%" height="19">&nbsp;&nbsp;&nbsp;<%= Rs.Fields("trpinjam").Value %></td>
</tr>
<tr>
<td width="50%" height="19" align="center"><b><font color="#8A3871">Tarikh
pemulangan</font></b></td>
<td width="50%" height="19">&nbsp;&nbsp;&nbsp;<%= Rs.Fields("trpulang").Value %></td>
</tr>
<tr>
<td width="50%" height="16" align="center"><b><font color="#8A3871">Catatan</font></b></td>
<td width="50%" height="16">&nbsp;&nbsp;&nbsp;<%= Rs.Fields("catatan").Value %></td>
</tr>
</table>
</td>
<td width="15%"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<% End If %>
<% End If %>
</body>
</html>

I have post this in other forums but it failed to help me. I hope someone here would reply the conclusion. this page only have 1 textbox to user give input & press enter. then the error appear
too few parameter expected 1.
Wan is offline   Reply With Quote
Old Sep 14, 2004, 00:47   #2
sinapra
SitePoint Addict
 
sinapra's Avatar
 
Join Date: Sep 2004
Location: secunderabad
Posts: 273
do you have to replace this with the input variable :
& "WHERE pemohon LIKE " & Replace(strSearch, "'", "''") & " " _
& "AND status = ON " _

where I believe strSearch should be replaced by the actual value. Its not taking the parameter, if I am right!!

Regards
sinapra is offline   Reply With Quote
Old Sep 14, 2004, 06:29   #3
Thing
Original Gangster
silver trophy
SitePoint Award Recipient
 
Thing's Avatar
 
Join Date: Oct 2000
Location: Jackson, NJ
Posts: 4,713
http://support.microsoft.com/default...b;en-us;216425
Thing is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 15:50.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved