November 2nd, 2012, 08:13 AM
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
November 2nd, 2012, 12:49 PM
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
if you found this post is useful click Give Rep button (bottom side on this reply ) and agree
November 3rd, 2012, 03:49 AM
@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.