Type mismatch: "rst" and cant get value out from database
Type mismatch: "rst" and cant get value out from database
am 25.04.2006 09:43:26 von Chris Wu
<%
strODBC = "Driver={MySQL};" & _
"Server=localhost;" & _
"Database=sistemkewangan;" & _
"Uid=root;" & _
"Pwd=;"
%>
<%
pwdNama = request.Form("pwdNama")
pwdsoalan = request.Form("pwdsoalan")
pwdJawapan = request.Form("pwdJawapan")
Dim Objrs
set Objrs = Server.CreateObject("ADODB.Connection")
Objrs.Open strODBC
Dim Strsql
Strsql = "SELECT dKat1 FROM pendaftaran WHERE dNId = '" & pwdNama & "'"
Strsql = Strsql + " AND " & "dSoa = " & "'" & pwdsoalan & "'"
Strsql = Strsql + " AND " & "dJa = " & "'" & pwdJawapan & "'"
set rst = Objrs.Execute(Strsql)
if rst.eof then
Set rst = Nothing
Set Objrs = Nothing
response.write ""
end if
%>
Kembali Katalaluan
DAPATKAN
KEMBALI KATALALUAN
<%
rst.Close()
Set rst = Nothing
%>
pls solve my problem....i cant get back password from database
MySQL.Thank you!!!
*** Sent via Developersdex http://www.developersdex.com ***
Re: Type mismatch: "rst" and cant get value out from database
am 25.04.2006 10:10:39 von Mike Brind
Chris Wu wrote:
> <%
> strODBC = "Driver={MySQL};" & _
> "Server=localhost;" & _
> "Database=sistemkewangan;" & _
> "Uid=root;" & _
> "Pwd=;"
> %>
>
>
> <%
> pwdNama = request.Form("pwdNama")
> pwdsoalan = request.Form("pwdsoalan")
> pwdJawapan = request.Form("pwdJawapan")
>
> Dim Objrs
> set Objrs = Server.CreateObject("ADODB.Connection")
> Objrs.Open strODBC
>
> Dim Strsql
> Strsql = "SELECT dKat1 FROM pendaftaran WHERE dNId = '" & pwdNama & "'"
> Strsql = Strsql + " AND " & "dSoa = " & "'" & pwdsoalan & "'"
> Strsql = Strsql + " AND " & "dJa = " & "'" & pwdJawapan & "'"
>
At this point, enter the following:
response.write Strsql
response.end
then post the result from your browser here.
--
Mike Brind
Re: Type mismatch: "rst" and cant get value out from database
am 25.04.2006 13:02:23 von Chris Wu
SELECT dKat1 FROM pendaftaran WHERE dNId = 'kokseng' AND dSoa = '1' AND
dJa = '-'
This sql query is the result in my browser.
*** Sent via Developersdex http://www.developersdex.com ***
Re: Type mismatch: "rst" and cant get value out from database
am 25.04.2006 13:02:38 von Chris Wu
SELECT dKat1 FROM pendaftaran WHERE dNId = 'kokseng' AND dSoa = '1' AND
dJa = '-'
It is the result i get from my browser....
*** Sent via Developersdex http://www.developersdex.com ***
Re: Type mismatch: "rst" and cant get value out from database
am 25.04.2006 13:50:28 von Mike Brind
Chris Wu wrote:
> SELECT dKat1 FROM pendaftaran WHERE dNId = 'kokseng' AND dSoa = '1' AND
> dJa = '-'
>
>
> This sql query is the result in my browser.
>
And does it give you any records if you run it against your database?
I suspect that it does not - which means that the code for rst.eof
runs, and within that, the recordset is set to nothing. Then you refer
to it again further down in your code, but by this time the object has
been destroyed.
You probably think that the javascript redirect would ensure that the
code lower down doesn't get run if rst.eof, but that's not how it
works. The whole page is parsed by the ASP engine from top to
bottom PRIOR to the resulting html being sent to the client. Client
side Javascript will not run until it has reached the client
(obviously).
I would change the If rst.eof code to this:
if rst.eof then
response.write ""
Else
dKat1 = rst("dKat1")
end if
Set rst = Nothing
Set Objrs = Nothing
Then <%= dKat1 %> should go later in your script, and you will need to
delete the rst.Close()
Set rst = Nothing
at the bottom.
--
Mike Brind