?
Solved

select MSSQL view fro ASP

Posted on 2003-02-22
11
Medium Priority
?
683 Views
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?


0
Comment
Question by:kkelley6
[X]
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
11 Comments
 
LVL 4

Expert Comment

by:Wakie
ID: 8002009
Hi kkelley, try this:

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

OR

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

OR

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

Regards,
Wakie.
0
 

Author Comment

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

Expert Comment

by:oceanASP
ID: 8002581
make sure u have permissions to perform a select query on your database.
0
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

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

Accepted Solution

by:
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.
0
 

Author Comment

by:kkelley6
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?
0
 

Expert Comment

by:genesysnet
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.
0
 

Expert Comment

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

Expert Comment

by:genesysnet
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.
0
 

Author Comment

by:kkelley6
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.
0
 
LVL 10

Expert Comment

by:apollois
ID: 8005307
kkelley6,

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,
apollois
0

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