a.. Error Type:
Provider (0x80004005)
Unspecified error
/mcse/admin.asp, line 37
when I try to logon again to the program immediately after I log off the
program writing in Asp linking to a database.
But after a while, I can logon again.
Actually, what is the cause of this problem? and How to solve it
Leo Lam
"Leo Lam" <bearforev...@hotmail.com> wrote in message
news:O6FxK2oDBHA.1772@tkmsftngp02...
Thanks for helping.
here is the code
<html>
<head>
<title>Administration Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link REL="STYLESHEET" TYPE="text/css" HREF="css/mcse.css">
</head>
<%
if validation(request("username"), request("password")) then
session("logon") = true
response.write "<frameset cols='200,*' rows='*' frameborder='yes'>"
response.write "<frameset rows='200,*' cols='*' frameborder='yes'>"
response.write "<frame src='ad_logo.asp' name='logo' noresize>"
response.write "<frame src='ad_opts.asp' name='options' noresize>"
response.write "</frameset>"
response.write "<frame src='ad_wiz.asp' name='main'>"
response.write "</frameset>"
response.write "<noframes>"
response.write "<body>"
response.write "<h1>No frames</h1>"
response.write "</body>"
response.write "</noframes>"
else
server.transfer("back.htm")
end if
%>
</html>
<script language = "vbscript" runat = "server">
function validation(username, password)
dim sqlstr
set adocon = server.createobject("adodb.connection")
adocon.open "Driver={Microsoft Access Driver (*.mdb)};dbq="&
server.mappath("/mcse/DataBase/mcse.mdb") 'this is line 37
set rs = server.createobject("adodb.recordset")
sqlstr = "select userid from users where username = '"& username &"' and
password = '"& password &"'"
rs.open sqlstr, adocon, 3, 1
if rs.recordcount = 0 then
validation = false
else
validation = true
end if
rs.close
set rs = nothing
adocon.close
set adocon = nothing
end function
</script>
I am a beginner of ASP
I think I have closed the connection by the last part of my script.
And I also found that the time allowing me to logon again is about a min.
Could you help me to solve this problem.
Thanks for helping me.
Best regards,
Leo
"farhan" <fs...@home.com> wrote in message
news:uXLMcMtDBHA.1276@tkmsftngp02...
1. make sure you have updated your MDAC drivers to atleast 2.6
http://microsoft.com/data/download.htm
Jet is not part of 2.6 download so you have to download and install them
separately
2. try using Jet instead
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
server.mappath("/mcse/DataBase/mcse.mdb")
> adocon.open strConn
3. Move your validation function within the <% %> and take out
> <script language = "vbscript" runat = "server">
></script>
4. use the connection object to run the query
validation = false
> set rs = adocon.Execute(sqlstr)
> if not rs.EOF then
> validation = true
> end if
5. first check if a form was subbmitted and contained some values
if validation(Trim(request("username")), Trim(request("password"))) then
else
end if
> function validation(username, password)
>
> dim sqlstr
if username = "" and password = "" then
validation = false
exit function
end if
....
6. change then name of your field from password to something else or enclose
it in [] as it is a reserved word in access
> sqlstr = "select userid from users where username = '"& username &"' and
> [password] = '"& password &"'"
7. and if your passwrod is case sensitive then you need to compare them in
your script
> sqlstr = "select []assword] from users where username = '"& username &"'
validation = false
> set rs = adocon.Execute(sqlstr)
> if not rs.EOF then
if rs(0).value = passwrod then
I will make the modification following your advice.
from Leo
"farhan" <fs...@home.com> wrote in message
news:uhkSKV6DBHA.2012@tkmsftngp04...