PDA

View Full Version : Error problem in microsoft access database using sql statement


scriptblur
09-23-2002, 07:21 AM
Hi guys... can you all please kindly help me with this problem... thank a lot...


i got this error '80004005'
Unspecified error
/sze_sean/html/check_booking.asp, line 15 for my program below...


Program:
<% @ Language=VBScript %>
<% Option Explicit %>

<%

Dim conn,rs,sql
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("zone.mdb"))

set rs=Server.CreateObject("ADODB.Recordset")

sql = "SELECT Week,Day,Zones FROM Zone WHERE Week='"&Request.Form("weeks")&"' , Day='"&Request.Form("days")&"' , Zones='"&Request.Form("location")&"'"

rs.Open sql, conn


if(Request.Form("weeks") <> "") then
if(Request.Form("days") <> "") then
if(Request.Form("location") <> "") then

Session("Week") = Request.Form("weeks")
Session("Day") = Request.Form("days")
Session("Zones") = Request.Form("location")
response.redirect="approved_page.asp"
else
response.redirect="Failed.asp"

end if
end if
end if

%>


Why is that such an eror, is it program cannot be done???
:confused:

glenngv
09-23-2002, 07:40 AM
try this:

sql = "SELECT Week,Day,Zones FROM Zone WHERE Week='"&Request.Form("weeks")&"' AND Day='"&Request.Form("days")&"' AND Zones='"&Request.Form("location")&"'"


change AND to OR as appropriate

scriptblur
09-24-2002, 04:00 AM
hi gelnn, thank... but still cannot... the same error prompted again.... are there other solutions?? or is it my sql statement can't call my database????

glenngv
09-24-2002, 04:15 AM
can you output the sql statement to the browser like this:

sql = "SELECT Week,Day,Zones FROM Zone WHERE Week='"&Request.Form("weeks")&"' AND Day='"&Request.Form("days")&"' AND Zones='"&Request.Form("location")&"'"
response.write sql
rs.Open sql, conn, 1, 4

then post the output here

scriptblur
09-24-2002, 05:45 AM
The output is:

SELECT Week,Day,Zones FROM Zone WHERE Week='' AND Day='' AND Zones='' error '80004005'
Unspecified error

/sze_sean/html/check_booking.asp, line 15

scriptblur
09-24-2002, 08:57 AM
The problem had been solved:

problem is the table name is similar with the database name.
(table name)Zone and (database name)zone.mdb.


Thank for the help..... glenngv