Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 17th, 2004, 11:02 PM
Authorized User
 
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default Selection Statements for MS Access

I am trying to make a Selection statement for my Access Database the "checks" 2 values. For example I only want the recordsets that have:
testing("SiteID") = SiteID <--Variable
testing("IPAd") = Request.ServerVariables("REMOTE_ADDR")

This is what I have, but it is not working:
Code:
IPCheck.Open "SELECT * From ClicksIN Where SiteID=" & SiteID & " " & "AND IP_Address=" & Request.ServerVariables("REMOTE_ADDR");"",ObjConn,1,2

 
Old July 17th, 2004, 11:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi there,

What are the datatypes of SiteId and IP_Address?

Try this
Code:
IPCheck.Open "SELECT * From ClicksIN Where SiteID='" & SiteID & "' AND IP_Address='" & Request.ServerVariables("REMOTE_ADDR") & "'",ObjConn,1,2
This should work.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 18th, 2004, 07:24 PM
Authorized User
 
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default

The datatypes:
"SiteId" is a number type field
"IP_Address" is a text type field

Using code that was givin to me by happygv i get the following error now:

Microsoft JET Database Engine error '80040e07'

Data type mismatch in criteria expression.

/test/HitIN.asp, line 32


 
Old July 18th, 2004, 08:27 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

  as per the siteid(its numeric), the query is like...

IPCheck.Open "SELECT * From ClicksIN Where SiteID=" & SiteID & " AND IP_Address='" & Request.ServerVariables("REMOTE_ADDR") & "'",ObjConn,1,2



 
Old July 18th, 2004, 10:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

gmoney060,

Yep, rajanikrishna's query should work for you.

It is always better to post the column datatypes too along with the query, as one wouldn't be aware of what datatype it is at your end, and that way you would be helped better and faster.

Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple SQL Statements from Excel to Access aabnormal Excel VBA 1 September 8th, 2008 11:54 PM
Database migration MS Access 2003 to MS SQL 2000 ayazhoda SQL Server 2000 3 April 23rd, 2007 11:38 AM
MS ACCESS 2003 FRONTEND AND MS SQL SERVER 2005 DB mohankumar0709 SQL Server 2005 3 March 23rd, 2007 12:48 AM
MS Data Grid control in ms access application roshla_p Access VBA 5 October 16th, 2006 02:37 AM
Case Statements in Access dbegg Access 2 September 17th, 2003 04:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.