select MSSQL view fro 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 '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?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

kkelley6Author Commented:
I tried your suggestions but, these are not tables....they are actually mssql views ( if that matters)
make sure u have permissions to perform a select query on your database.
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

kkelley6Author Commented:
I have previously grant select permission to the db id I am using and public.
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kkelley6Author Commented:
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?
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.
Sorry that should be does not select any columns that do not exist (not rows)
Or perhaps (given the invalid objects name - sentryview) the view you are calling is trying to access another view which has not been configured.
kkelley6Author Commented:
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.

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,
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.