I want to know how to print my query from an rs.open.
我想知道如何从rs.open打印我的查询。
I know it's probably a silly question but I was trying like this:
我知道这可能是一个愚蠢的问题,但我是这样想的:
rs.open "Select * from employees" & condition & " AND " & condition2 & condition3 & " Order by " & order, con, 3, 1
Trying to do a response.write from the rs
试图从rs做一个response.write
Response.Write(rs)
But it's not working, any advice?
但它没有用,有什么建议吗?
2 个解决方案
#1
2
I've discovered a way to print the rs without saving it on a variable, just if anyone else needs it.
我发现了一种打印rs而不将其保存在变量上的方法,就像其他人需要它一样。
We can display the recordset data using source
it returns a String value that indicates the data source of the Recordset object.
我们可以使用source显示记录集数据,它返回一个String值,指示Recordset对象的数据源。
Just using it this way:
只是这样使用它:
response.Write(rs.source)
#2
1
If you want to display the SQL query, you can't just print the recordset.
如果要显示SQL查询,则不能只打印记录集。
Instead, you need to save the SQL query in a variable and print that.
相反,您需要将SQL查询保存在变量中并打印出来。
Pseudocode because I'm writing this on my phone and don't remember the right syntax to declare variables in ASP Classic:
伪代码,因为我在手机上写这个,并且不记得在ASP Classic中声明变量的正确语法:
SQL = "select * from ..."
rs.open SQL, con, 3, 1
Response.write(SQL)
#1
2
I've discovered a way to print the rs without saving it on a variable, just if anyone else needs it.
我发现了一种打印rs而不将其保存在变量上的方法,就像其他人需要它一样。
We can display the recordset data using source
it returns a String value that indicates the data source of the Recordset object.
我们可以使用source显示记录集数据,它返回一个String值,指示Recordset对象的数据源。
Just using it this way:
只是这样使用它:
response.Write(rs.source)
#2
1
If you want to display the SQL query, you can't just print the recordset.
如果要显示SQL查询,则不能只打印记录集。
Instead, you need to save the SQL query in a variable and print that.
相反,您需要将SQL查询保存在变量中并打印出来。
Pseudocode because I'm writing this on my phone and don't remember the right syntax to declare variables in ASP Classic:
伪代码,因为我在手机上写这个,并且不记得在ASP Classic中声明变量的正确语法:
SQL = "select * from ..."
rs.open SQL, con, 3, 1
Response.write(SQL)