主题:比较变量查询得的到值与手工赋的值是否相等的问题
以下为程序代码,其中查询得到的值与手工赋的值是相同的.如果需要使查询数据库得到的htfa值等于变量afth手工赋的相等.令程序输出"=="内容.下边的程序不成功,该如何修改?请朋友们告知一二.感激不尽...
-------------------------------------
<%
<%
uid = "sa"
pwd = "mypwd"
ServerName = "localhost"
DatabaseName = "mydb"
set cnn = server.createobject("ADODB.Connection")cnn.ConnectionString = "Provider=SQLOLEDB;Password=" & pwd & ";Persist Security Info=True;User ID=" & uid &";Data Source=" & ServerName &";DATABASE=" & DatabaseName
set rst = Server.CreateObject("ADODB.Recordset")
id = trim(request("id"))
sql="select * from pact_table where id=" + id
cnn.open
rst.open sql,cnn,1,3
htfa = rst("htfa") '数据库中htfa字段的值与变量afth手工赋的值,内容是相同的。afth = "字符串"
htfa = cstr(htfa)
afth = cstr(afth)
if htfa = afth then
response.write ("==")
else
response.write ("!=")
end if
%>
-------------------------------------
<%
<%
uid = "sa"
pwd = "mypwd"
ServerName = "localhost"
DatabaseName = "mydb"
set cnn = server.createobject("ADODB.Connection")cnn.ConnectionString = "Provider=SQLOLEDB;Password=" & pwd & ";Persist Security Info=True;User ID=" & uid &";Data Source=" & ServerName &";DATABASE=" & DatabaseName
set rst = Server.CreateObject("ADODB.Recordset")
id = trim(request("id"))
sql="select * from pact_table where id=" + id
cnn.open
rst.open sql,cnn,1,3
htfa = rst("htfa") '数据库中htfa字段的值与变量afth手工赋的值,内容是相同的。afth = "字符串"
htfa = cstr(htfa)
afth = cstr(afth)
if htfa = afth then
response.write ("==")
else
response.write ("!=")
end if
%>