Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #21 (permalink)  
Old July 3rd, 2008, 05:49 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;When you say it's a different paradigm, please give me an example...

> Research Object Oriented Programming (OOP) - A very different world to simple Classic ASP.
> Research Interpretation Vs Compilation - Classic ASP is interpreted where .net is compiled

;;;I believe that the choice is quite easy for me. I need to go the route of ASP.net that will greatly help me develop better applications with less coding.

Event though clearly a more powerful language IME .net does require more code. I was made to go on a couple of introduction to ASP.NET using c# (the main language people in our office use for .NET) The small convert this classic system to .net projects we carried out is what I call my experience. Perhaps I am wrong but as mentioned above it was certainly more code

Wind is your friend
Matt
www.elitemarquees.com.au
Reply With Quote
  #22 (permalink)  
Old July 3rd, 2008, 06:11 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

All:

Let me appologize - The post above was in response to your 'Posted - 07/04/2008 : 05:44:03 AM' post. It is early here and I failed to realize there was a second page to this topic.

frakey:
Good day things are very good down under. Looking forward to the tri-nations as im sure you are????? I am actually a Kiwi who know lives in Sydney. I will be hoping the All Blacks give your guys a good run around this Sat. Do you follow the rugby? I so good luck to your boys - If not the Tri-nations is the most important rugby event on the yearly calendar, NZ, Aussie and SA...

Anyhow back to the topic and to answer your questions directed at me on this second page.

;;;This is something new... OO type programming. Please explain
As mentioned in my last post research Object Oriented Programming

This is the best ASP forum around. You have been lucky enough to have Mr ASP address your post. For some time now Imar and several others around here have taught me a huge amount. Providing you make every effort to help yourself before taking thier time Im sure you will benefit also. Old Pendant seems to have a firm hold on the reigns in this area now. Remember to be specific, post errors and the offending code and you will make the most of everyones time. I used to come here poting several problems a week, sometimes several a day. Now I have a good handle on ASP and come here to help others where I can but primarily to read and learn.

A good day to you - Go the All Blacks :o)



Wind is your friend
Matt
www.elitemarquees.com.au
Reply With Quote
  #23 (permalink)  
Old July 3rd, 2008, 07:02 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

The results from the new code I have inserted in as follows:

Session(AccessLevel) is ====
Is it numeric? True
As a string, length is 0
And its TypeName is Empty


*** BINGO!!! ***

Just exactly as Imar and I suspected.

Your
    Session("AccessLevel")
is *EMPTY*. That means NO VALUE has EVER been assigned to
    Session("AccessLevel")

So the flaw is *NOT* on this page. It's on whatever page is SUPPOSED to put a value into
    Session("AccessLevel")

SORRY! We should have done this debug first thing.

Analyzing:

Session(AccessLevel) is ====
  -- so notice there is *NOTHING* in between the first == and the second ==
Is it numeric? True
  -- this one is what was tripping us up!!!
  -- I didn't realize that an EMPTY value would show "True" as IsNumeric!!
As a string, length is 0
  -- But we already knew that from the ==== stuff.
And its TypeName is Empty
  -- Empty is *NOT* the same thing as a blank string.
  -- If your code had done
        Session("AccessLevel") = ""
  -- then TypeName would be STRING (just a zero length string)
  -- As I said, EMPTY means that NO VALUE was EVER stored in the session variable!

Okay? Time to go looking at the page where you *THOUGHT* you were setting the AccessLevel and, obviously, are not.
Reply With Quote
  #24 (permalink)  
Old July 3rd, 2008, 07:05 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

One thing you might want to do:

Find *all* the session values you currently have active. That's easy, and a good thing to for any debugging related to sessions.

<%
...
For Each name In Session.Contents
    Response.Write name & " [" & TypeName(Session(name)) & "]::" & Session(name) & "::<br>" & vbNewLine
Next
...
%>
Reply With Quote
  #25 (permalink)  
Old July 4th, 2008, 01:53 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

>> You have mismatched parentheses. Always count left and right parens. The numbers must match.

Sorry, my bad. I typed the example to debug session variables in this forum post directly and overlooked the parentheses issue.

@frakey: with regards to my ASP.NET 3.5 book: yes, you can certainly follow along with just the Express Edition. The EE is a very powerful piece of software; for many web sites - including the one built in the book - it's all you need.

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #26 (permalink)  
Old July 4th, 2008, 04:33 PM
Authorized User
 
Join Date: Jul 2008
Location: Deneysville, Free State, South Africa.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Greetings to all contributors,

Thank you for your latest postings. Wow, I'm really going through a learning curve. So much to learn... But I must admit I'm really enjoying it.

Just a quick hello, I have had a very busy day (and my wife's birthday) so not much research and testing done on your suggestions. Will return to answer in full tomorrow.

Good news is that I have contacted the Microsoft office in South Africa to enquire about the 2008 express additions. No stock at the moment. I will probably have to download from Microsoft's site directly. Slight problem with broadband.

With me doing the changes to the code, I have noticed red exclamation marks next to the listed server behaviour functions in Dreamweaver. DW has its own recordset dialog box in a graphical interface. Is it at all possible to somehow add your suggested coding into the SQL query part of this dialog box as apposed to inserting it directly into the code? I believe that this might remove all the red exclamation marks. Kindly advise. I could take a snapshot of the dialog box and post it on a site and then you guys the hyperlink.

I greatly appreciate and respect your assistance and therefore I need to do my part on further research and testing before I can continue to post. I will then post further questions.

Will make contact again tomorrow.

Greetings
frakey

Reply With Quote
  #27 (permalink)  
Old July 4th, 2008, 04:36 PM
Authorized User
 
Join Date: Jul 2008
Location: Deneysville, Free State, South Africa.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Matt,

Yeah, I'm really passionate about the game of rugby. Best wishes for your team. Maybe a tremendous game.

Chat soon.
Frakey

Reply With Quote
  #28 (permalink)  
Old July 5th, 2008, 03:50 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Quote:
quote:Originally posted by frakey
 Greetings to all contributors,

Is it at all possible to somehow add your suggested coding into the SQL query part of this dialog box as apposed to inserting it directly into the code?
Yes, but...

You never showed us the "bare bones" code as created by DW before you started modifying it.

The closest we have is from the posting where you showed

WADANews_cmd.CommandText = "SELECT approvedFlag, category, id, memberId, postDate, title, userText FROM News WHERE If session("AccessLevel") = "1" then memberId = "" Else If session("AccessLevel") = "2" then memberId = session("UserID") End If ORDER BY postDate"
WADANews_cmd.Prepared = true

setQueryBuilderSource WADANews_cmd, WADbSearch1_whereClause, false

In point of fact, I almost *DID* modify that code first thing, but the last line there threw me: What the heck *IS* WADbSearch1_whereClause and what does that SUB setQueryBuilderSource do???

I could make a *stab* at *guessing* what *might* work. But it becomes really really a guess. Here goes...Code in blue is the original from your post. All other code is my added stuff.
Code:
<%
Dim WADANews
Dim WADANews_cmd
Dim WADANews_numRows

Set WADANews_cmd = Server.CreateObject ("ADODB.Command")
WADANews_cmd.ActiveConnection = MM_conn_glen_STRING

Dim level, where, SQL
level = session("AccessLevel")
If TypeName(level) = "Empty" Then
    Response.Write "ERROR: session(AccessLevel) is EMPTY...using 0, *NON*-admin<br>"
    level = 0
End If

where = " WHERE memberid = " & CLNG(Session("UserID")) ' assume *NOT* an admin
' but if *IS* admin, then get rid of the where
If isNumeric(level) Then If CDBL(level) = 1 Then where = "" 

SQL = "SELECT approvedFlag, category, id, memberId, postDate, title, userText " _
    & " FROM News " _
    & where _
    & " ORDER BY postDate, memberid "
Response.Write "DEBUG SQL: " & SQL & "" & vbNewLine

WADANews_cmd.CommandText = SQL
WADANews_cmd.Prepared = true
Set WADANews = WADANews_cmd.Execute
WADANews_numRows = 0
%>
<%
Dim WADANews_1__numRows
Dim WADANews_1__index

WADANews_1__numRows = 10
WADANews_1__index = 0
WADANews_numRows = WADANews_numRows + WADANews_1__numRows
%>
Notice that I got rid of the setQueryBuilderSource line. Since I have no idea what it is supposed to do--and since so far as I can see the code is complete, as is--it seemed safest to just kill it.
Reply With Quote
  #29 (permalink)  
Old July 6th, 2008, 06:05 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi frakey,

The red exclamation mark comes from the server behavior that is no longer able to reconstruct itself from the code. For simple SQL queries it's able to extract the query and show it in the query box in Dreamweaver. However, as soon as you start messing around with the query through code, the server behaviors no longer work completely. As long as the code runs fine at runtime, you can safely ignore the red exclamation marks.

So, from now on, you're probably better off manually changing the code for these queries and skip the server behaviors (of course you can still use them for existing code). Or, better yet, write your own data access code which typically requires a lot less code (but a longer learning time as you need to understand the kind of code you need to write).

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #30 (permalink)  
Old July 8th, 2008, 03:19 PM
Authorized User
 
Join Date: Jul 2008
Location: Deneysville, Free State, South Africa.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Greetings to all,

A disappointing weekend as we lost against the all Blacks. You must be real happy Matt. Hopefully next time...

With all the intermittent problems I have been experiencing in not getting a value for session("access level") I have decided to rather recreate what I originally done.

I have changed the name of the session variable to session ("UserAccess") and retained session ("UserID").

In the original coding I included the two response.write for both of the above. Results were successful. Both session variables returned results.

I then inserted the last coding suggestion from Old Pedant. Once again, results were successful. If I logged in to the system as administrator, the recordset returned all records, and if I logged in to the system as a user, the recordset returned only the user records.

I am still going to attempt to include the code of the previous postings and check the results. I will post the results shortly.

For the moment though, I would like to express my sincere gratitude to all you amazing guys who have wholeheartedly contributed to making this project a success. Thank you so much for your assistance, guidance and suggestions.

What is so exciting is the amount "of code" that I have learnt. I trust this is the beginning of a continual learning curve. I am certainly going to continue to use the forum.

Once again, thank you for your encouragement and patience. It's been an absolute pleasure.

Cheers
frakey

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Case Statement In Where Clause Logic dwj119 SQL Server 2000 4 October 27th, 2011 03:14 PM
Problems using case statement in where clause vghiya SQL Server 2000 3 May 28th, 2007 05:12 AM
Select statement with where clause with 2 conditon Yasho VB.NET 2002/2003 Basics 7 May 16th, 2007 01:40 PM
If statement in Where Clause jdziggy SQL Server 2000 2 March 16th, 2007 08:08 AM
USING SQL IF Statement in WHERE clause rit01 SQL Server 2000 17 March 15th, 2007 08:33 AM



All times are GMT -4. The time now is 08:05 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.