If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > MS Access DB does not take "Where" parameter?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-13-04, 01:57
yawong yawong is offline
Registered User
 
Join Date: Dec 2004
Posts: 3
Angry MS Access DB does not take "Where" parameter?

I am trying to use VB script in ASP with MS Access DB on IIS 6.
I connected the DB, and can "select", "insert", and etc.
But looks like Access doesn not let me do "select * from tablename where fieldname=valuehere"
If I delete out the "where...", it works perfectly fine.
So is it the limitation of access database?
I know when I use Access DB with VB Script ASP, it will not allow "Recordset.MovePreviews", but is the "where..." syntax not allowed as well?
Any help will be greatful.
Reply With Quote
  #2 (permalink)  
Old 12-13-04, 10:10
White Knight White Knight is offline
Registered User
 
Join Date: Dec 2004
Location: York, PA
Posts: 95
Where is valid so maybe it is the way you are trying to use it.

Post some code so we can see
Reply With Quote
  #3 (permalink)  
Old 12-14-04, 03:22
yawong yawong is offline
Registered User
 
Join Date: Dec 2004
Posts: 3
<%
username=request.Form("username")
passwd=request.Form("passwd")

if username="" or passwd="" then
response.Redirect("default.asp")
end if

Dim DBCon
Dim DBR

Set DBCon = Server.CreateObject("ADODB.Connection")
DBCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=e:\database\clerkprofile.mdb"
Set DBR = Server.CreateObject("ADODB.Recordset")

SQLString = "SELECT * FROM clerkinfo WHERE username=" & username
DBR.open SQLString, DBCon

if DBR.EOF or DBR("passwd")<>passwd then
response.Redirect("default.asp")
end if

response.Cookies("ClerkID")("ID") = username
response.Cookies("ClerkID")("FullName") = DBR("clerkname")
response.Cookies("ClerkID")("Login") = "Yes"
response.redirect("main.asp")
%>
<!--#include file="closedb.asp"-->

Thanks for your help!!
Reply With Quote
  #4 (permalink)  
Old 12-14-04, 08:13
White Knight White Knight is offline
Registered User
 
Join Date: Dec 2004
Location: York, PA
Posts: 95
Thumbs up

Ok this really is pretty simple
I'm assumimg that Username is a textural field so the information needs to be passed in single quotes like this

SQLString = "SELECT * FROM clerkinfo WHERE username='" & username & "'"
DBR.open SQLString, DBCon
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are On
Pingbacks are On
Refbacks are On