select MSSQL view fro ASP

Posted on 2003-02-22
Medium Priority
Last Modified: 2012-06-21
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 'VIEW_NV390MSG'.

/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:

StrSQL="SELECT oncalllabel FROM VIEW_NV390MSG WHERE messageid='" & TecMsgidVal & "'"
Response.Write StrSQL
Set RS1 = Conn.execute(StrSQL)

and my db connect is made as:

ADOConnectStr = "driver={SQL Server};server=XXX;database=HELP;uid=HELP;pwd=HELP;"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ADOConnectStr
Server.ScriptTimeout = 300

Is what I am trying not possible?

Question by:kkelley6
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8002009
Hi kkelley, try this:

StrSQL = "SELECT oncalllabel FROM [VIEW_NV390MSG] WHERE messageid = '" & TecMsgidVal & "'"


StrSQL = "SELECT oncalllabel FROM [VIEW_NV390MSG] WHERE messageid = " & TecMsgidVal & ""


Change the name of your database table, "VIEW_NV390MSG", to something else.


Author Comment

ID: 8002027
I tried your suggestions but, these are not tables....they are actually mssql views ( if that matters)

Expert Comment

ID: 8002581
make sure u have permissions to perform a select query on your database.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 8004568
I have previously grant select permission to the db id I am using and public.

Accepted Solution

genesysnet earned 600 total points
ID: 8004686
Can you run the query OK from Query Analyser, logging in as the same user as specified in your ASP application?

Query Analyser may give you a more specific error that makes more sense.

Author Comment

ID: 8004752
Hmm... good idea. Actually, i get the same type of message.

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'sentryview'.

What does that mean I should do?

Expert Comment

ID: 8005132
Can check the view configuration to ensure that you are querying the correct table and that it does not try to select any rows that do not exist...

Sounds like you are trying to select from a table that does not exist.

Expert Comment

ID: 8005149
Sorry that should be does not select any columns that do not exist (not rows)

Expert Comment

ID: 8005153
Or perhaps (given the invalid objects name - sentryview) the view you are calling is trying to access another view which has not been configured.

Author Comment

ID: 8005305
The issue was related to permissions of the view I created.  I did not think to try the same query from the analyser.  Basically, i was able to create the view, was the owner of the view but did not have the ability to select using the view.
LVL 10

Expert Comment

ID: 8005307

I am confused about your QA results.  It refers to the object 'sentryview' whereas your ASP code refers to 'VIEW_NV390MSG'

How are these related?

The obvious thing to check is to verify using SQL Server Enterprise Mgr that you have views named 'VIEW_NV390MSG' and 'sentryview'.  Double check the spelling, and the security permissions.

Please run the EXACT same query in the QA as you are using in ASP, and post the results.

Best Regards,

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question