Groups | Blog | Home
all groups > sql server new users > december 2006 >

sql server new users : newbie question - using asp.net datasource control to access sqlsvr 2005



Geary
12/8/2006 1:26:11 PM
This may be a case of the blind leading the blind. Sorry if this is an
extremely basic question.

I am fairly new developing ASP.NET 2.0 websites using VS2005. Our dba
is fairly new SqlServer 2005.

I am trying to access the data he has loaded in sqlsvr. He has set it
up using windows authentication. He has create a couple of groups. I
am in the "developers" group with access to some "views" that he has
created.

In VS2005, using the "configure data source" wizard for a SqlDataSource
control, I am able to see this sql box on the network. I am about to
successfully connect. I am able to select a database and to select a
view. But the sql string fails. The error message is "There is an
error executing the query. Please check the syntax of the command and if
present, the types and values of the parameters and ensure they are
correct. Invalid object name 'vColor'."

I am trying to set this up just like I do for a local instance of sqlsvr
and the same way I did in my training class. Is there something
different I need to do? Or is there something my dba needs to do on his
end?

What's weird is that I can manually access and see the data in these
views in VS2005 server explorer and in SSMS, just not with datasource
controls.

If there is any other pertinent information that may help someone help
me, please ask. I'll supply what I can or ask for further clarification
from the dba.

Roger Wolter[MSFT]
12/12/2006 4:24:06 PM
Yes, that's exactly what would happen. You web pages connect as ASPNET not
you. This also happens sometimes when switching from debugging which runs
as you to normal which runs as the web page.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

[quoted text, click to view]

Geary
12/12/2006 4:50:35 PM
I think I may have found the solution to my problem.

Would it make sense that if the dba only gave read access to the data to
my personal user id and not to user "aspnet" that I could access the
data but the sqldatasource controls could not?

[quoted text, click to view]
Geary
12/12/2006 4:52:07 PM
I think I may have found the solution to my problem.

Would it make sense that if the dba only gave read access to the data to
my personal user id and not to user "aspnet" that I could access the
data but the sqldatasource controls could not?

[quoted text, click to view]
Geary
12/18/2006 12:00:00 AM
Our DBA added the user "aspnet" to the user group. Unfortunately I am
still unable to access the data in the views from within my asp.net
pages. Apparently something else is going on. I reviewed everything I
can get my hands on and I am confident that I have everything set right.
I am sure the problem is at his end. Unfortunately I am also not real
familiar with the security model of sqlsvr 2005 to help him. Plus his
paranoia wouldn't allow me to examine the inner workings of his server
anyway. Are all dba's so paranoid?

Probably our best hope is to try to find a local consultant who is a wiz
at sqlsvr 2005 and pay for a day of his time. Have him review the
security settings and tell us where we are going wrong. Damn, I hate
admitting defeat but it looks like the root of the problem is outside of
my power to directly fix.
[quoted text, click to view]
Geary
12/19/2006 12:00:00 AM
We have discovered something else that might be causing the problem and
would explain why I can connect to the database, view the tables, but
not access the records, getting the error message that the view
(vcolor) is an invalid object.

The dba has an unique schema set up for the views that I have access to.
These have a qualifer of "netapps". So to properly access the records
I should query netapps.vcolor. But for some reason I don't see the
schema within Visual Studio, in neither the server explorer nor the
datasource configure wizard. When I view the database in SSMS I DO see
the qualifing schema.

Does anyone have any idea why the schema is not visible in Visual Studio
and what I can do to fix it?

Any help is appreciated.

[quoted text, click to view]
Roger Wolter[MSFT]
12/19/2006 9:03:46 AM
Views and schemas that you don't have access to will not be visible. If
you are not including the schema name in the view name myschema.myview it
won't be visible if you don't have the right default schema set.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

[quoted text, click to view]

Geary
12/19/2006 12:54:51 PM
Solved it.

The query will always fail in the datasource configuration wizard. Just
step thru the wizard. Go to source view of the datasource and
manually edit the select command to include the schema.

For example

SELECT * FROM [vColor]

becomes

SELECT * FROM [netapps].[vColor]


[quoted text, click to view]
AddThis Social Bookmark Button