Click to See Complete Forum and Search --> : [RESOLVED] A Rs.EOF Question


Evren Betimen
12-11-2009, 04:01 AM
CusNameFld = request("CustomerNameField")

SQL = "SELECT Customers FROM Sales WHERE CustomerName = "&CusNameFld&" "

set RS = Server.CreateObject("ADODB.RecordSet")
RS.open SQL , conn , 1 , 3

if not rs.eof then
...Some Code...
end if

...Some HTML code...

if rs.eof then
...(Needed code)... (I want to show all customers)


I want to return CusNameFld variable to assign a value as "0" to show all records on my ASP Page. Is it possible to do?

Thanks in advance,
Greetings

yamaharuss
12-11-2009, 07:50 AM
What the heck do you mean by "assign a value as "0"???

Evren Betimen
12-14-2009, 01:51 AM
What the heck do you mean by "assign a value as "0"???

...
CusNameFld = "0" (This value shows all customers)

SQL = "SELECT Customers FROM Sales WHERE CustomerName = "&CusNameFld&" "

I don't know how to return variable if rs.eof. I don't want to write code again. Is it possible?

yamaharuss
12-14-2009, 06:35 AM
SQL = "SELECT Customers FROM Sales "
If CusNameFld <> "0" then SQL = SQL & "WHERE CustomerName = "&CusNameFld&" "

Evren Betimen
12-24-2009, 06:42 PM
Thank you for reply. It works