Hi experts,
This problem has got me stumped. I think this is a Asp1.1 page. What I'm trying to do is check the value from the Request.From("daterequest"
) textbox against an access database to see if that date is already in the database. The database field is of type "text" the for the submit button is below:
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsAddrecord 'Holds the recordset for the new record to be added
Dim strSQL 'Holds the SQL query to query the database
Dim searchstring
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB
.Connectio
n")
'Set an active connection to the Connection object using DSN connection
adoCon.Open "DSN=appointment"
'Create an ADO recordset object
Set rsAddrecord = Server.CreateObject("ADODB
.Recordset
")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT * FROM appointment;"
'Set the cursor type we are using so we can navigate through the recordset
rsAddrecord.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsAddrecord.LockType = 3
'Open the recordset with the SQL query
rsAddrecord.Open strSQL, adoCon
**************************
**********
**********
**********
**********
**********
*
The code and the variables that are inside the code are the only lines that i wrote the rest if my boss
'searchstring = Request.From("daterequest"
)
If rsAddrecord.Find("daterequ
est = 02/20/2007") Then
window.open()
End If
**************************
**********
**********
**********
**********
**********
**
Now I approached this problem thinking I would just do a recordset.find for the date. I wasn't able to get it to work hard coded and I don't know the syntax to do a .find for a variable string. The second thing i thought would work was to make a new recordset and fill it based on an SQL statement that pulled records WHERE daterequest = userdate then I would count the recordset and if it was greater than zero then "Date is already taken" but once again I couldn't get it to work. I'm not sure where I'm going wrong..
thanks experts
James
Start Free Trial