#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    select MSSQL view from ASP


    I am having issues selecting from an MSSQL DB view from my ASP. I recieve the following error message:

    Microsoft OLE DB Provider for ODBC Drivers error '80040e37'

    [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'w_sales_cust '.

    /cco/syseng/eventhelp/EventHelpResults1.asp, line 359

    My query is correct and if i switch back to the table the select works fine. I am using the following to select:
    SELECT Company, consultantId, DataYear, DataMth, Class_Trade, SUM(Quantity) AS Total_Quantity, SUM(Sales_Amount) AS Total_Sales FROM w_sales_cust WHERE DataYear=" & Int(IntYear) & " and DataMth=" & Int(IntMonth) & " and consultantId=" & Int(ConsultantId) & " GROUP BY Class_Trade, Company, consultantId, DataYear, DataMth
  2. #2
  3. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,594
    Rep Power
    278
    system can not find your table it looks like you connected to different database on the same server try to add database name to your query
    like

    Code:
    FROM databaseName..w_sales_cust
    GK
    __________________________________________________ _____
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0
    @GK, the problem is not with the connection. It connecting to the database. It work perfectly well for TABLES. w_sales_cust is a VIEW, so I don't if there is a special way to connect to database views. Please, I really need your help.

Similar Threads

  1. Help! how to transfer MSSQL 2000 to MSSQL 2005
    By buknoii in forum Microsoft SQL Server
    Replies: 3
    Last Post: October 27th, 2006, 06:42 PM
  2. view record with Select combo
    By martialdc in forum ASP Development
    Replies: 4
    Last Post: November 25th, 2005, 04:00 AM
  3. MSSQL encryption of view + procedures
    By rangers in forum Microsoft SQL Server
    Replies: 2
    Last Post: July 25th, 2005, 11:10 AM
  4. List Box one click select/deselect with Multi Select
    By ImNewbie in forum Microsoft Access Help
    Replies: 1
    Last Post: August 30th, 2004, 10:02 AM

IMN logo majestic logo threadwatch logo seochat tools logo