Forums

ASP

This topic is locked

How to filter recordset?

Posted 17 Aug 2002 15:57:45
1
has voted
17 Aug 2002 15:57:45 Sokac / posted:
I have big problem. Don't know how to filter recordset by column and is that possible.
I have access database and I filtering recordset by "id".
------------------------------------------------------------------------------------
<%
Dim priacc__MMColParam
priacc__MMColParam = "1"
if (Request.QueryString("id" <> "" then priacc__MMColParam = Request.QueryString("id"
%>
<%
set priacc = Server.CreateObject("ADODB.Recordset"
priacc.ActiveConnection = MM_infobase_STRING
priacc.Source = "SELECT * FROM priacc WHERE ID1 = " + Replace(priacc__MMColParam, "'", "''" + ""
priacc.CursorType = 0
priacc.CursorLocation = 2
priacc.LockType = 3
priacc.Open()
priacc_numRows = 0
%>
------------------------------------------------------------------------------------
I need to apply one more filter to this recordset.
Database has 150 fields (columns) but mostly there are 10-30 columns with needed data.
I need to filter all columns that are <> 0. How to do this without building big sql query.
I only need to exclude "0" columns from recordset.

Thanks.

Replies

Replied 19 Aug 2002 15:48:08
19 Aug 2002 15:48:08 Andrew Watson replied:
priacc.Filter = "ID1 <> 0"

:: Son, im Thirty.... ::
Replied 19 Aug 2002 16:05:35
19 Aug 2002 16:05:35 Sokac / replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
priacc.Filter = "ID1 &lt;&gt; 0"

:: Son, im Thirty.... ::
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Thanks for answer? but i need to filter(exclude) all colums(fields) that have 0 value not ID1 column. I have 150 columns and i want to see only colums with value different from zero.
Replied 21 Aug 2002 14:54:58
21 Aug 2002 14:54:58 johannes nel replied:

u're going to have to loop through each col in the table and check the indiv values.

example

dim i
for i = 0 to rs.fileds.count -1
if rs.fields(i).value &lt;&gt; 0 then...

end if
next

this is what u want but is an extremely crap sollution so think about it again!



Reply to this topic