scriptblur
10-21-2002, 09:00 AM
Hi guys...
Please help me... i have stuck in this problem for a long time...
Currently i am doing an editing function, however problem arise...
i wanted to check first before doing editing, check if it is the same
user by using StrComp to compare the "UserID" that is passed in by form with the database "UserID", this checking succeed. But the check for blank field in the database has failed... it kept giving NO!!!!
Why????
<% @ 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("database.mdb"))
set rs=Server.CreateObject("ADODB.Recordset")
sql = "SELECT UserID, Avail FROM Zones WHERE Week = "&request.form("weeks")&" AND Day = '"&request.form("days")&"' AND Character = '"&request.form("location")&"' AND Starttime AND Endtime BETWEEN "&request.form("times")&" AND "&request.form("timesno")&""
rs.Open sql, conn
Session("Week") = Request.Form("weeks")
Session("Day") = Request.Form("days")
Session("Character") = Request.Form("location")
Session("Starttime") = Request.Form("times")
Session("Endtime") = Request.Form("timesno")
if (StrComp(rs("UserID"),Session("UserID")) = 0 or StrComp(rs("UserID"),"""")= 0) then
Response.Redirect"delete_edit.asp"
else
if (StrComp(rs("UserID"),"") = 0 AND StrComp(rs("Avail"),"") = 0) then
Response.Write "Yes"
else
Response.Write "No"
end if
end if
%>
Please help me... i have stuck in this problem for a long time...
Currently i am doing an editing function, however problem arise...
i wanted to check first before doing editing, check if it is the same
user by using StrComp to compare the "UserID" that is passed in by form with the database "UserID", this checking succeed. But the check for blank field in the database has failed... it kept giving NO!!!!
Why????
<% @ 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("database.mdb"))
set rs=Server.CreateObject("ADODB.Recordset")
sql = "SELECT UserID, Avail FROM Zones WHERE Week = "&request.form("weeks")&" AND Day = '"&request.form("days")&"' AND Character = '"&request.form("location")&"' AND Starttime AND Endtime BETWEEN "&request.form("times")&" AND "&request.form("timesno")&""
rs.Open sql, conn
Session("Week") = Request.Form("weeks")
Session("Day") = Request.Form("days")
Session("Character") = Request.Form("location")
Session("Starttime") = Request.Form("times")
Session("Endtime") = Request.Form("timesno")
if (StrComp(rs("UserID"),Session("UserID")) = 0 or StrComp(rs("UserID"),"""")= 0) then
Response.Redirect"delete_edit.asp"
else
if (StrComp(rs("UserID"),"") = 0 AND StrComp(rs("Avail"),"") = 0) then
Response.Write "Yes"
else
Response.Write "No"
end if
end if
%>