我创建了一个脚本,正在2个不同的系统上使用。一种是带有SQL Server Express 2019的Windows 10,另一种是带有SQL Server Express 2014的Windows 7(32位)。 我正在使用的数据库具有相同的结构。我在ASP Classic中使用的代码在两台机器上完全相同!但是在win7机器上不能正常工作!
我正在查询数据库,问题是我得到的某些值是空的! 我正在使用的代码如下:
<%
Set rs21 = Server.CreateObject("ADODB.Recordset")
strSQL21 = "SELECT * FROM otherfiles WHERE animalid LIKE '" & lngRecordNo & "'
AND historyid LIKE '" & historyid & "' order by datedone DESC"
rs21.Open strSQL21,adoCon
%>
BLAH BLAH BLAH
<%
Do While not rs21.EOF
historyid = rs21("historyid")
if not historyid = "" then
Set rshis = Server.CreateObject("ADODB.Recordset")
strSQLhis = "SELECT * FROM history WHERE id_no LIKE '" & historyid & "' order by id_no DESC"
rshis.Open strSQLhis,adoCon
'------------------- if I remove the following line (Set rscol) it works fine ---------------------------
Set rscol = Server.CreateObject("ADODB.Recordset")
strcol = "SELECT * FROM hospitals WHERE id_no = "& rsGuestbook21("hosid") &" order by id_no DESC"
rscol.Open strcol,adocon
color = rscol("color")
%>
BLAH BLAH BLAH
<%=rs21("datedone")%> ---> empty value
<%=rs21("id_no")%> ---> works fine!!!
我100%确认我的表具有其值。实际上,正如我上面提到的,但设置rscol = Server.CreateObject(“ ADODB.Recordset”)时,这些值将变为“空”。评论这行工作正常。你能帮我吗?
提前谢谢!