User Profile

Collapse

Profile Sidebar

Collapse
gateshosting
gateshosting
Last Activity: Aug 18 '07, 03:48 AM
Joined: Dec 6 '06
Location: Pa
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • gateshosting
    replied to Parse a friends page on MySpace
    Look at the query string for each additional page, then just do a loop in ASP to get each page, until you find "Error, page not found" or whatever it happens to be on MySpace. I have done this for many situations like this.

    So you can loop like (Ce careful not to cause an endless loop:
    Code:
    do until ISayStop (Or for x = 1 to 100, etc.)
    
        x = x + 1
        xVar = getSrc("http://myspace.com/page?page="
    ...
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:12 AM. Reason: removing website address

    Leave a comment:


  • You will probably have to do a redirect with a query string, then pull the values out of the query string.

    Michael C. Gates
    See more | Go to post

    Leave a comment:


  • Simple... I am guessing you are using javascript's window.location = to send them to a new page. The easiest way is to probably do a compare.
    Code:
    <%
    
    cPage = request.servervariables("script_name")
    
    %>
    <option value='/mypage.asp'<%
      if cPage = "/mypage.asp" then
        response.write " selected"
      end if %>>Take me to My Page</option>
    ...
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:12 AM. Reason: removing website address

    Leave a comment:


  • Probobly the most simple way is to write a function to check the date first...

    function isThisADate(xAs Date)

    on error resume next

    if isnull(xAsDate) then
    isThisADate = false
    exit function
    end if

    if isDate(xStringA sDate) then
    isThisADate = true
    exit function
    end if

    if err.number <> 0 then
    isThisADate = false...
    See more | Go to post

    Leave a comment:


  • gateshosting
    replied to Fomat decimal numbers in ASP
    All you have to do is use the formatnumber() function...

    formatnumber(19 2.394884,2) would give you 192.3... it will also round up.

    Best regards,

    Michael C. Gates
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:13 AM. Reason: removing website address

    Leave a comment:


  • Just FYI for anyone reading... I ran tests:

    1. Joining the same table three times, to get the 3 different products was a little slower than the script almaz gave me.
    Code:
    AVG(CASE WHEN [Item Number] = 'A' THEN [Price] END) AS A,
    AVG(CASE WHEN [Item Number] = 'B' THEN [Price] END) AS B,
    AVG(CASE WHEN [Item Number] = 'C' THEN [Price] END) AS C
    Best regards,

    Michael C. Gates
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:17 AM. Reason: removing website address

    Leave a comment:


  • gateshosting
    replied to select count(table) problem
    Glad to help. I think you can do this with one view though. It would group it by Director / Genre, then you can do a select count(*) from myView where genre = x, etc. Once you have the view, you can summarize the data further. The view is like a temporary table. Structured the same way.

    Best regards,

    Michael C. Gates
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:17 AM. Reason: removing website address

    Leave a comment:


  • gateshosting
    replied to Adding text to a column!
    If it is a varchar, you can do something like this:
    Code:
    SELECT
     CASE
      WHEN len(FLD) = 6 THEN '84'+FLD
      WHEN len(FLD) = 5 THEN '840'+FLD
      WHEN len(FLD) = 4 THEN '8400'+FLD
      WHEN len(FLD) = 3 THEN '84000'+FLD
      WHEN len(FLD) = 2 THEN '840000'+FLD
      WHEN len(FLD) = 1 THEN '8400000'+FLD
     END
    
    FROM TABLE
    You may be able to do this with a loop, but...
    See more | Go to post

    Leave a comment:


  • gateshosting
    replied to Adding text to a column!
    Do you need to input this with a SQL script, or can you do the formatting programmaticall y on the client/server side?
    See more | Go to post

    Leave a comment:


  • Are you using windows 2003 or 2000 server?

    Regards,

    Michael C. Gates
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:15 AM. Reason: removing website address

    Leave a comment:


  • gateshosting
    replied to Median?
    I am new to functions. I just finally learned the real difference between views and stored procedures. Well, sort of, lol...

    What are functions used for exactly? I mean, I know what they are used for in VB, .NET, etc., but not SQL.

    My existing median SP has to be run individually per customer. So if there are 10 customers, that's 10 scripts sent from my ASP page. It is too much overhead because these big companies are impatient,...
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:16 AM. Reason: removing website address

    Leave a comment:


  • gateshosting
    started a topic Median?

    Median?

    Ok, I have searched everywhere, and came up with a short-term solution. But I still need [oh no... daughter just spilled coffee all over my laptop and desk!!!! ok, it's clean...] help. I developed a statement that gets a median value from an invoicetotals view. Basically it takes the middle 2 values (in case there is an even number of rows) and averages them. The problem is, I want to do this in a customer grouping, to get all values at once. I have...
    See more | Go to post

  • gateshosting
    replied to CASE in WHERE clause?
    Thanks... sorry it was a topic already covered. I found that later doing some searches.

    I understand now how it only returns a value. I am thinking like VB or C#, and not SQL. I am new to the logic of SQL. Thanks,

    Michael C. Gates
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:16 AM. Reason: removing website address

    Leave a comment:


  • Awesome... I will give it a try.

    Do you think that script will perform better than joining the line items table three times to create the values? I did a script that works, but think (logically) that it will be too much overhead... but maybe not. I don't know much about specifics of performance in SQL Server.
    Code:
    SELECT
    	i.[invoice number] AS [Invoice Number],
    	[i].[Paid] as [Paid],
    
    	SUM([li1].[quantity]
    ...
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:14 AM. Reason: removing website address

    Leave a comment:


  • gateshosting
    replied to select count(table) problem
    I don't think that will work because you are still doing a record count on the rows, which because you have joined the 2 tables for thriller and Drama. They row will give you a count of 1 no matter what genra it is.

    Try something like this:

    Code:
    SELECT
      DIR_NAME,
      SUM(CASE WHEN [T1].[GENRE] = 'Thriller' THEN 1 ELSE 0) AS THRILLERS,
      SUM(CASE WHEN [T1].[GENRE] = 'Drama' THEN 1 ELSE 0) AS DRAMAS
    ...
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:14 AM. Reason: removing website address

    Leave a comment:


  • Is it due to the location of the file? How about using virtual='/root/blahblah/file.asp' instead?

    Michael C. Gates
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:17 AM. Reason: removing website address

    Leave a comment:


  • gateshosting
    started a topic CASE in WHERE clause?

    CASE in WHERE clause?

    I thought this syntax was correct, but I can't figure out why it won't work. Maybe it just is not supported?
    Code:
    CREATE PROCEDURE spTEST @includepaid bit AS
    
    SELECT FIELD FROM TABLE
    WHERE
      SOLD = 1
      AND CUSTOMER = 2
    
      CASE
        WHEN @includepaid = 1 THEN AND [Paid] = 1
      END
    This is not my exact query, but you get the drift. All my logic is correct in my SP....
    See more | Go to post

  • It looks like you are going to want to get into stored procedures. You can't use DECLARE @ANYTHING in a SQL statement from ASP. At least, I don't think so.

    But if you have a stored procedure that is:

    Code:
    CREATE stored procedure sp_MySP
      @name varchar,
      @id int
    AS
    
    UPDATE MyTable
    SET [Name] = @name
    WHERE ID = @id
    You could call it like this:...
    See more | Go to post

    Leave a comment:


  • So you open the web page, and nothing happens? There HAS to be an error somewhere.

    Do you have a global.asa file that holds variables, and you are running the virtual directory as it's own application, etc.?

    First, I would start by writing out some basic info so you can debug...

    Code:
    response.write server.mappath("/") & "/whatever/mydb.mdb"
    response.end
    This...
    See more | Go to post
    Last edited by MMcCarthy; Feb 5 '07, 03:15 AM. Reason: removing website address

    Leave a comment:


  • Ahhh, didn't think of that. Glad you put that in my mind... Thanks for clarifying.

    MS SQL stores it in Date/Time format. I guess there is a way to get the Int value, or Decimal value, but I think you have to convert it. I would personally add a new field, copy the values to it, and then re-add the date/time field correctly formatted.

    Michael C. Gates...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...