|
this is the error message i got: Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
/project/Verify.asp, line 13 (line 13 is this: myDSN = "DSN=HTC"
below is my code:
<%
'Cks to see if value is in table. Returns a -1 if update, 0 if need to add record
Function CkExistence (sqlstring)
Dim rscount ' The recordset object
Dim myDSN
Dim conn
myDSN = "DSN=HTC;"
'Opens a connection object
set conn = Server.CreateObject("ADODB.Connection")
conn.open myDSN
set rscount=conn.execute(sqlstring)
if rscount.eof then
ckexistence = 0
else
ckexistence = -1
end if
End Function
%>
<%
'Declare all local variables
Dim conn, strSQL, strSQLtest, rs
msg = 0
strSQLtest = "SELECT CustID FROM tblCustomers where CustUserid = '" & Request("txtUserid") & "'"
'Check to see if values exist
if CkExistence(strSQLtest) = 0 then
'A record does not exist currently.
msg = 1
response.redirect "login.asp?msg=" & msg
else
'A record exists. Verify password.
strSQLtest = "SELECT CustID FROM tblCustomers where CustUserid = '" & Request("txtUserid") & "' and Password = '" & request("txtPassword") & "'"
if CkExistence(strSQLtest) = 0 then
'Your password is not valid.
msg = 2
response.redirect "login.asp?msg=" & msg
else
'Your password and userid are valid. Get the custID.
strSQL = "SELECT * FROM tblCustomers where CustUserid = '" & Request("txtUserid") & "' and Password = '" & request("txtPassword") & "'"
'Opens a connection object
set conn = Server.CreateObject("ADODB.Connection")
conn.open "C:/Inetpub/wwwroot/database/HTC.mdb"
set RS=Server.CreateObject("adodb.recordset")
RS.open strSQL, conn
if not rs.eof then
'Read the custid
custid=CStr(RS("CustID"))
'Go to the next display.
response.redirect "htc-test-request_form.asp?customerid=" & custid
end if
end if
end if
%>
sorry for the long code, but i think it will be clearer if i post the complete code. was my function syntax incorrect?
thanks
|